Given a prime . The task is to count all the primitive roots of .
A primitive root is an integer x (1 <= x < p) such that none of the integers x – 1, x2 – 1, …., xp – 2 – 1 are divisible by but xp – 1 – 1 is divisible by .
Input: P = 3
The only primitive root modulo 3 is 2.
Input: P = 5
Primitive roots modulo 5 are 2 and 3.
Approach: There is always at least one primitive root for all primes. So, using Eulers totient function we can say that f(p-1) is the required answer where f(n) is euler totient function.
Below is the implementation of the above approach:
- Primitive root of a prime number n modulo n
- Number of factors of very large number N modulo M where M is any prime number
- Find sum of modulo K of first N natural number
- Find coordinates of a prime number in a Prime Spiral
- Primitive Abundant Number
- Find the quadratic equation from the given roots
- Find the minimum number to be added to N to make it a prime number
- Find if two given Quadratic equations have common roots or not
- Program to find the Roots of Quadratic equation
- Find the integral roots of a given Cubic equation
- Seeds (Or Seed Roots) of a number
- Given a number x , find y such that x*y + 1 is not a prime
- Program to find the Nth Prime Number
- Find the position of the given Prime Number
- Program to find the next prime number
- Find prime number K in an array such that (A[i] % K) is maximum
- Find all the prime numbers of given number of digits
- Find largest prime factor of a number
- Find sum of a number and its maximum prime factor
- Analysis of Different Methods to find Prime Number in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.