1

Can we find a general $n$ where the following expression holds for all $a$ : $$a^{n+1} \equiv a \pmod n$$

I have tried it by using Fermat's theorem and even arrived at it for $n=2$ as $$a^{3}\equiv a \pmod 2$$

I have also tried using Wilson's theorem $$(p-1)!\equiv -1 \pmod p$$ to see if I can replace $(p-1)!$ by $a$ but am stuck here!

player3236
  • 16,600

1 Answers1

10

I thought the only $n$ that this holds is $n=2$, but it wasn't.

First suppose that $n$ is not square-free. Then there exists some prime $p$ such that $p^2 \mid n$.

We now have $p^{n+1} \equiv 0 \pmod {p^2}$, so $p \not\equiv p^{n+1} \pmod {p^2}$.

This shows that $p^{n+1} \not\equiv p \pmod n$, which implies that $n$ must be square-free.

Hence $n$ is a product of distinct primes, and suppose for a prime $p$, $p \mid n$.

We have, by FLT, $a^p \equiv a \pmod p$.

Hence $a^{n+1} = a^{p (n/p)+1} \equiv a \cdot a^{n/p} \pmod p$, and we want to find $n$ such that:

$$a^{n/p} \equiv 1 \pmod p \text{ for all } p \nmid a \text{ and } p \mid n$$

By the existence of primitive roots, we can find $a'$ such that the multiplicative order of $a'$ is precisely $p-1$.

Thus we require $(p-1) \mid \dfrac n p$. By $\gcd (p,p-1)=1$, this is equivalent to showing that $(p-1) \mid n$.

I do not know how many numbers are there that satisfy the equation, but $42$ does:

$$42 = 2 \times 3 \times 7\text{ , and }1,2,6 \mid 42$$

and we do have $a^{43} \equiv a \pmod {42}$ for all $a$.

Easier examples include $n=2$ (trivial) and $n=6$ (not quite trivial). And also $1806$ as well.

EDIT: Found this on OEIS: A014117. There are no more. A (short) proof that this is finite is also in the [LINKS] section, compiled by Don Reble.

player3236
  • 16,600
  • 3
    This comment in OEIS shows that it is indeed full:

    It is easy to see that for n > 1, n must be an even squarefree number. Moreover, the set P of prime divisors of all such n satisfies the property: if p is in P, then p-1 is the product of distinct elements of P. This set is P = {2, 3, 7, 43}, implying that the sequence is finite and complete. - Max Alekseyev, Aug 25 2013

    – player3236 Oct 09 '20 at 07:26
  • We can probably finish using a= primitive root modulo p_i , where p_i is a prime dividing n . – Sunaina Pati Nov 16 '20 at 13:53