2

Here are few steps which made sense when analysing the prime numbers

Step 1: For any odd number "$a \in Z^+ $" e.g. 17

Step 2 : $a$ is $2^{n} < a < 2^{n+1}$

Step 3: now get the list starting $ b_i $ where $b_i \equiv 2^{n+1} \pmod a $ as follows

Step 4: $b_1 = 15 $ here, $(32\equiv15 \pmod {17 }$)

Step 5: Then for each step double the result till we again reach the $2^{n}$ as follows

$ b_{i +1}= 2\times b_i(30\equiv13 \pmod {17 }$), in this case

$ 26\equiv9 \pmod {17 }$

$ 18\equiv1 \pmod {17} $

and so on till $b_i = 2^n$

When we make a list it will be $[15, 13, 9, 1,2,4,8,16]$ and the list count $l$ is $8$

$$m = \frac{a-1}{mod\_list\_length} $$

Now $m = \frac{(a-1)}{l}= 2 $

When we run a program in python obviously we get $m = \frac{(a-1)}{l} $.

$a$ is almost always a prime number for any odd when $m \in Z^+$. Python program below to check primality of odd +ve integer. Perhaps we get exceptions!

import math
import time

def find_power_of_two(a): if a <= 0 or a % 2 == 0: raise ValueError("Input must be a positive odd integer.") return int(math.log2(a))

begin = time.time()

Example usage:

a = int(input("Enter a positive odd integer: ")) n = find_power_of_two(a) print(f"The value of n such that 2^n < {a} < 2^(n+1) is: {n}") M = 1 << (n + 1) b = M % a l = [] sum = 0 while b != (1 << n): while b < (1 << (n - 1)): l.append(b) sum += b b = b << 1 l.append(b) sum += b b = (b << 1) % a l.append(1 << n)

print(l) sum += 1 << n m = (a - 1) / len(l) print('The ratio to odd integer less 1 by number of moduli is ', m) print('sum of all moduli are ', sum) print('The ratio between sum of moduli and a is', sum / a) if (a - 1) % len(l) == 0: print(f'{a} is a Prime number') else: print(f'{a} is not a prime number') end = time.time() print('Time taken to test is', end - begin)

Following python code gives the results by method below and exceptions also displayed. For example, for odd numbers upto 10000, the exceptions (that are not divisible by 3 or 5) are [341, 1387, 1729, 2047, 2701, 2821, 3277, 4033, 4369, 4681, 5461, 6601, 7957, 8321, 8911] These exceptions are falsely detected as Prime numbers by mod function.

from decimal import*
from fractions import Fraction
import time
getcontext().prec = 1000
n = int(input("Enter a number till which you need Prime numbers by moduli method \n:"))
i = 1
l = []
for i in range(9,n):#(2 is only even Prime number, 3 leads to infinite loop. Therefore I have not started from 3)#
    if i%2 !=0 and i % 5 != 0 and i % 3 != 0:
        l = l + [i]
#print(l)# List of Odd numbers out of divisibility by other than 2, 3, 5
begin = time.time()
nl = []
for j in l:
    i = 0
    for i in range(j):
        if 2 ** i < j < 2 ** (i + 1):
            break
    m = 2 ** (i - 1)
    #print("The numerator for n is = ",m)
    M = 2 ** (i + 1)
    Max = 2 ** (i + 2)
    lst = []
#print(j)
while M != m:
    M = M % j
    lst = lst + [M]
    M = M * 2
lst = lst + [m]
lst = lst + [m * 2]
#print('List of remainders in the list for given odd number is', lst)
rl = lst

#print('Total number of moduli are', len(rl))
ratio = (j - 1) / len(lst)
#print(&quot;The ratio between (n-1) and Nom is   &quot;, Fraction((j - 1), len(lst)))
# returns Fraction
# print((n-1)//len(lst),&quot;,&quot;, Fraction((n-1)%len(lst)),&quot;/&quot;,len(lst))
if (j - 1) % len(lst) == 0:
    nl = nl + [j]

print("list of Prime numbers out of Odd numbers is\n",nl) print(len(nl)) end = time.time() print("Time taken to calculate list of Prime numbers is", end - begin) ls = [] a = 0 for num in range(9, n): if num > 2: for i in range(2, num): if num % i == 0: break else: a += 1 ls = ls + [num] # print(a, '|',num )

print(ls)

print(len(ls))

using sieve method

Uncommon elements in List

res_list = [] for i in nl: if i not in ls: res_list.append(i) for i in ls: if i not in nl: res_list.append(i)

# printing the uncommon

print("The uncommon of two lists is : " + str(res_list)) print(len(res_list))

Even though I thought of relationship with Fermat's little theorem, the nonprime numbers are not exactly the Carmichael numbers.)

One of the important observation I made is due to its association with mod function with $2^n$, any prime of $2^n -1$ will have high $m $ which turns out very fast in running to give the output as prime number or not. Next will be prime numbers of $2^n +1$ forms.

My question is "Is there any way to identify the $m$ as predictable integers?

Bill Dubuque
  • 272,048
  • 2
    I try to follow your procedure, and I get more exceptions. In fact I get 341, 561, 645, 1105, 1387, .... For example, to show how $a=561=3\cdot 11\cdot 17$ is one of the exceptions I get, doubling modulo $561$ starting from $512$ (the biggest power of two below $561$), I get 512→463→365→169→338→115→230→460→359→157→314→67→134→268→536→511→461→361→161→322→83→166→332→103→206→412→263→526→491→421→281→1→2→4→8→16→32→64→128→256→512. That is $40$ arrows, or period length $40$. And $(561-1)$ is divisible by $40$ (quotient is $14$). So am I doing it right? – Jeppe Stig Nielsen May 21 '23 at 09:04
  • Yes. You are correct. In the code above, I intentionally removed the numbers divisible by 3 or 5. That is why within 1000, I got only 341 as exception. So it is till 10000 – Sivakumar Krishnamoorthi May 21 '23 at 10:12
  • 2
    If you use PARI/GP, if you define a function getm(a)=(a-1)/znorder(Mod(2,a)), then you can calculate what you call here m for any odd input number a (the function will fail for even a). It will in general return a fraction, for example getm(559) gives 93/14. But for all primes it will give an integer, for example getm(563) gives 1. And for the "exceptional" odd integers a that we are talking about, it will give an integer as well, even though a is composite, like in the example of my first comment, getm(561) gives 14. – Jeppe Stig Nielsen May 21 '23 at 12:26
  • Jeppe's post contains a very valuable insight in making progress on this problem but unfortunately it is hidden in the Pari-code, namely that what you call the 'mod list length' is the multiplicative order of 2 mod a. I believe that is the right terminology if you want to google more about this. Closely related: as Jeppe said $m$ will be often be a fraction but always be an integer if $a$ is prime. A way to guarantee that $m$ is always an integer (I am not sure if that is what you want) is to replace the $a-1$ in the enumerator by $\phi(a)$ with $\phi$ the Euler-totient function. – Vincent May 21 '23 at 16:12
  • (For $a$ prime we have $\phi(a) = a-1$ so nothing changes) – Vincent May 21 '23 at 16:12
  • 1
    Another link: the question if there are infinitely many prime $a$ for which we get $m = 1$ is known as Artin's conjecture. It has a number of generalizations, although I do not know if your question is among those. A very extensive survey about the state of the art on Artin's conjecture and related conjectures was written by Pieter Morree of the Max Planck institute a few years ago – Vincent May 21 '23 at 16:14
  • Yes. By available calculations, it is possible to observe that we have infinitely many $m =1$. My question is about predictability of $m$. If we see for first 500 odd integers, m =1 dominates (67), followed by m = 2, (50). There is no m = 7, 12, 13, 15, 17, 19, 20, 21. Possibily we may get on further exploration. (I'm not sure, why there is no m= 7) This needs further work to see the predictability of $m$ – Sivakumar Krishnamoorthi May 22 '23 at 11:14
  • I have attached Google sheet for reference (https://docs.google.com/spreadsheets/d/1-O1kBqGFK6VrqUNb5uNHjhUTwH2fsSPsUozfhtXcULU/edit?usp=drivesdk) – Sivakumar Krishnamoorthi May 22 '23 at 11:30
  • The non-appearance of 7 is very interesting, although I would expect 7 to occur only for the case where $a$ is a prime congruent 1 modulo 7. How many of those did you check? – Vincent May 22 '23 at 13:09
  • I have checked odd numbers upto 999 only. Need to explore more. The finite number of moduli form the basis of single cycle of infinite nested square roots of 2 in finding value of $ 2\cos(\frac{2^n}{a}\cdot\pi)$ – Sivakumar Krishnamoorthi May 23 '23 at 11:10
  • Here is the reference https://math.stackexchange.com/questions/4246889/interrelationship-between-cyclic-infinite-nested-square-roots-of-2-and-summation – Sivakumar Krishnamoorthi May 23 '23 at 11:18
  • Run through all odd a and print those for which m is 7: forstep(a=3,+oo,2,getm(a)==7&&print1(a,", ")) Then search OEIS with that: A152307 – Jeppe Stig Nielsen May 23 '23 at 23:10
  • Really impressive. Learning a lot through this discussion. Thank you very much. How to run above code in python? – Sivakumar Krishnamoorthi May 24 '23 at 23:37

0 Answers0