We generalize the problem to the following problem:
Let a be a given positive integer. For every natural n, there is a positive integer m such that n divides am+m.
In fact, we proceed by induction on n. Obviously this statement holds for n=1. Now assume n>1 and this statement holds for every natural number less than n. Consider two cases:
Case 1: n=p is a prime. If p∣a we are done. If not, take m=(a+1)(p−1)+1. Then
am+m=a(a+1)(p−1)+1+(a+1)(p−1)+1≡(a+1)p≡0(modp).
Case 2: n is a composite. Let p be the largest prime divisor of n. Write n=pbq1a1⋯qkak as the prime factorization of n and put n=pn1.
By induction hypothesis (to n1<n), there is a positive integer k such that ak+k≡0(modn1). This leads to ak+k=n1q, and we represent q=pq1+r with 0⩽r<p. Thus, ak+k=n1(pq1+r)≡rn1(modn). Now, put A=(q1−1)⋯(qk−1), or 1 if n has only one prime divisor.
Since p is the largest prime divisor of n, it follows that A and p are coprime. Hence, there is a positive integer c such that
Ac≡1(modp)⟺(p−1)rAc≡(p−1)r≡−r(modp).
This leads to
pb−1q1a1⋯qkakr(p−1)Ac≡−pb−1q1a1⋯qkakr(modpbq1a1⋯qkak).
Hence, we have
q1⋯qkφ(n)rc≡−n1r(modn).
Finally, define d=q1⋯qkc or c, if n has one prime divisor. We get rφ(n)d≡−n1r(modn). Put m=rφ(n)d+k. Then,
am+m≡arφ(n)d+k+rφ(n)d+k≡ak+k−n1r≡n1r+rφ(n)d≡n1r−n1r≡0(modn)
□