Posts

Finding Primitive roots of a prime number n using python

Image
  What is primitive root? A number g is a primitive root modulo n if every number coprime to n is congruent to a power of g modulo n  you can  learn more here:  Primitive roots For Example: For example, 3 is a primitive root modulo 7, but not modulo 11, because Modulo 7, 3^1≡3 3^2≡2 3^3≡6 (3^3=27mod7=6 ) 3^4≡4 3^5≡5 3^6≡1(mod7) you got all the possible results: 3,2,6,4,5,1 You can't get a 0, but 0 is not coprime to 7, so it's not a problem. Hence 3 is a primitive root modulo 7. Whereas, modulo 11, 3^1≡3, 3^2≡9, 3^3≡5, 3^4≡4, 3^5≡1 3^6≡3(mod11) And modulo 11, you only got the possible values 3,9,5,4 and the sequence start’s repeating after 3^6, so you will never get a 3^k≡2   I have implemented a code in python that finds all Primitive roots   of a number😀   Python ...