# Divisibility: 2 3 5 7 13 on $n^{13}-n$ [duplicate]

I am doing these kinds of revision on my own. And I have read some of the similar posts here and learned some techniques in doing it. However, when I was doing this question, I have trouble figuring out the divisibility of $5$. For 13, it is obvious that $n^{13} \equiv n( \text{mod} 13)$. For 7, factorize as $n(n^6 + 1)(n^6-1)$. The second parenthesis is divisible by $7$ by the same theorem. For 3, further factorization becomes $n(n^6+1)(n^2-1)(n^4+n^2+1)=(n^6+1)(n^3-n)(n^4+n^2+1)$. The middle part is divisible by $3$. For 2, when n is odd, the outcome is even; when n is even, the outcome is even.

However, for 5, I am trying to find something like $n^5-n$ or $n^4-1$ in the factorization process. But I can't find it. My careless mistake?? Or this has a special method to duel with. Thank you.

## marked as duplicate by Jyrki Lahtonen, Lord Shark the Unknown, Community♦Sep 19 '18 at 6:05

• We have Euler's Theorem stating that $a^{\varphi(n)}\equiv 1\pmod{n}$. For $n=5$ we have $\varphi(5)=4$ and so $$n^{13}\equiv n^4\cdot n^4\cdot n^4\cdot n\equiv 1\cdot 1\cdot 1\cdot n\pmod5$$ whenever $n,5$ are coprime. For the cases where they are not, the result should be obvious already. – String Sep 19 '18 at 4:29
What you essentially need to note is Euler's theorem : if $a$ is coprime to $l$ then $a^{\phi(l)} \equiv 1 \mod l$. Taking to the power $k$, $k \in \mathbb N$ on both sides gives $a^{k\phi(l)} \equiv 1 \mod l$. .Multiplying by $a$, we get $a^{k\phi(l) + 1} \equiv a \mod l$.
Now, the question is : how do I show that $l = 2,3,5,7,13$ works? Somehow show that $13 = k\phi(x) + 1$ for some $k$ when $x = 2,3,5,7,13$. But, this is the same as showing that $13-1 = 12$ is a multiple of $\phi(x)$ when $x = 2,3,5,7,13$, which is true since $\phi(p) = p-1$ for $p$ prime, so $\phi(x)$ is respectively $1,2,4,6,12$ which is a set of factors of $12$. Therefore, by our extended Euler theorem , the result follows for all the primes i.e.$a^{13} \equiv a \mod x$ for all these $x$.
puzzle 125 here contains another staggering example of the technique I used here. Note that $a^{13} - a$ is also a multiple of the product of all these primes we have mentioned, so it is a multiple of $2730$.