+ 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
1 Answer
0
Tianerad party game (999) So are you gonna try making the code to calculate primitive roots?š
Hot today
What's wrong? :(
1 Votes
Why won't my image display
0 Votes
I have made a calculator in which my % (Percentage) not work correctly for 100%50 or 100%20.
2 Votes
How the answer is 50?
0 Votes
Number of Ones ( C++ ) question!
1 Votes