+ 2
[MATH CODING FOR FUN] Primitive root of unity mod P
How about making a code to calculate primitive roots of unity modulo P? Wanna give it a try? Definition of primitive roots of unity mod P: An integer A (1 †A †Pâ1) is a primitive root of unity (mod P) if A^K is not congruent to 1 (mod P) for 1 †K †Pâ2. (P is a prime number) For example, P=7 There are: 3^1 is 3(mod 7), 3^2 is 2(mod 7), 3^3 is 6(mod 7), 3^4 is 4(mod 7), 3^5 is 5(mod 7). 5^1 is 5(mod 7), 5^2 is 4(mod 7), 5^3 is 6(mod 7), 5^4 is 2(mod 7), 5^5 is 3(mod 7). So, it should be: INPUT: 7 OUTPUT: 3,5 Iâm looking forward to seeing many people writing codes in many different languages for this topic. đ https://code.sololearn.com/c864moLa12x6/?ref=app
2 Answers
0
Tianerad party game (999) So are you gonna try making the code to calculate primitive roots?đ