Homepage › Solution manuals › Ivan Niven › An Introduction to the Theory of Numbers › Exercise 2.3.45* (Number of solutions of $x^2 \equiv x \pmod m$)
Exercise 2.3.45* (Number of solutions of $x^2 \equiv x \pmod m$)
Find the number of solutions of for any positive integer .
Answers
Write the number of solutions of . We first determine if is a power of a prime ( ).
Then
Since and are relatively prime,
because , with and , with ( ) imply : this is impossible.
Therefore
This gives
Now let be an integer greater than , and its decomposition in prime factors. Then, using (1),
So if and only if is a simultaneous solution of one of the systems of congruences
where . The Chinese Remainder Theorem shows that these systems have exactly one solution modulo . Since there are such system, where is the number of prime divisors of .
The number of solutions of is , where is the number of prime divisors of .
I checked this result with a Python program, up to . The maximum is for , for which has solutions.