Sunday, May 17, 2015

Conjecture about the product of the primitive roots modulo a prime number

Related with my previous post, I found a similar property in the product of the primitive roots modulo p, I will call them, Pr_p, where p is a prime number. 

Let P(n) be the previous prime smaller than n, then:






And N(n) be the next prime greater than n, then:






So it seems that the product of the primitive roots modulo a prime p is at a distance d1 of its previous closer prime and a distance d2 of its closer next prime, being d1 and d2 = 1 or a prime number.













(*) Notice that in the sample by chance d1 and d2 incidentally are exactly the previous and next prime numbers of the original p = 17.

I asked about this possible property, and the answer I received from one of the fellows at Mathematics Stack Exchange was very amazing, you can see here the question and the answer.

I have tested it in the interval of primes in [1,1000]. This is the Python code:

#import cProfile

def primitive_roots():
    import fractions
    from sympy import divisor_count, totient, mobius, is_primitive_root, nextprime, prevprime
    from math import floor, log, sqrt
    from gmpy2 import mpz, c_mod, mul, is_odd, is_prime, add, sub, divexact, set_cache, is_square, digits, div, gcd

    # Print calculation time
    def printTime():
        import time, datetime
        ts = time.time()
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
        print(st+"\n")

    def prim_root_prod(value):
        calprod = 1
        for i in range (1,value):
            if is_primitive_root(i,value)

               calprod = calprod * i
        return calprod

              
    printTime()

    print("N(Pr_p) TEST")   
    n=nextprime(1)
    while n<1000:
        calprod = prim_root_prod(n)
        res = nextprime(calprod)-calprod
        if is_prime(res) or (res == 1):
            print("Success for " + str(n) + " , d2 is " + str(res))
        else:
            print("If this message appears, then the conjecture is false for " + str(n) + " because the distance d2 is not a prime number: " + str(res))
   
        n=nextprime(n)

      
    print("P(Pr_p) TEST")   
    n=nextprime(3)
    while n<1000:
        calprod = prim_root_prod(n)
        res = calprod-prevprime(calprod)
        if is_prime(res) or (res == 1):
            print("Success for " + str(n) + " , d1 is " + str(res))
        else:
            print("If this message appears, then the conjecture is false for " + str(n) + " becase the distance d1 is not a prime number: " +  str(res))
   
        n=nextprime(n)
   
    printTime()
       
#cProfile.run('primitive_roots_test()')
primitive_roots_test()

 

2 comments: