Define a good pair to be a pair (a,n) of positive integers, with n>1, such that any prime dividing an−1 also divides ak−1 for some 0<k<n. We claim that the only good pairs are (2,6), (1,n) for any n, and (2m−1,2) for any m≥2.
It is straightforward to verify that all of these work, so it remains to show that these are the only good pairs. First, note that we have taken care of all cases where a=1, so we may henceforth assume a≥2. Also, note that if n=2, then (a,n) is a good pair if and only if any prime dividing a2−1=(a+1)(a−1) also divides a−1. Since the greatest common factor of a+1 and a−1 is at most 2, it follows that a+1 must be a power of 2. Thus, we have identified all the good pairs (a,n) with n=2.
It remains to show that the only good pair (a,n) with a≥2 and n≥3 is (2,6). Let Φn(x) be the nth cyclotomic polynomial, and for a prime p, let vp(x) be the largest k such that pk∣x. Let ordp(x) denote the order of x modulo p, meaning the smallest o such that xo≡1(modp). We first prove a sequence of lemmas.
Lemma 4. Let n,k, and d be positive integers with n=kd. Then if a is a positive integer and p a prime such that either
* p is odd and p∣ak−1, or
* p=2 and 4∣ak−1,
then we have
vp(an−1)=vp(ak−1)+vp(d).
Proof. Consider the binomial expansion
an−1=((ak−1)+1)d−1=i=1∑d(id)(ak−1)i.
Under either of the given assumptions, vp((id)(ak−1)i) has a unique minimum at i=1, hence
vp(an−1)=vp(d(ak−1))=vp(ak−1)+vp(d).□
Lemma 5. For any n≥3 and any prime p such that ordp(a)=n, we have vp(Φn(a))≤vp(n).
Proof. The statement obviously holds if vp(Φn(a))=0. Let k=ordp(a). Since Φn(x)∣xn−1, it follows that k∣n.
Suppose p is odd, and note that p∣ak−1. Lemma 4 applies, giving vp(an−1)=vp(ak−1)+vp(n/k). Since Φn(x)∣xk−1xn−1, it follows that
vp(Φn(a))≤vp(ak−1an−1)=vp(n/k)≤vp(n).
Next, we consider the special case when p=2. Since 2∣ak−1, a must be odd. Then, since Φn(x)∣xk−1xn−1, we have
n≡1+a+⋯+an−1≡a−1an−1≡0(mod2).
Thus, n is even, and we can write n=2m.
Now, note that 4∣a2−1. Also, since n>2, 2 is a proper divisor of n, so Φn(x)∣x2−1xn−1. Thus, by Lemma 4 again, we have the remaining case
v2(Φn(a))≤v2(a2−1a2m−1)=v2(m)≤v2(n).□
Lemma 6. For any a≥2 and n>1, we have Φn(a)≥41aϕ(n).
Proof. Let pn=∏i=1n(1−2−i). We first prove that pn≥41 for all n≥1. It is clear that pn≤21 for all n≥1. Hence, for each k, pk−pk+1=2−k−1pk≤2−k−2. We therefore have
p1−pn=i=1∑n−1(pi−pi+1)≤i=1∑n−12−i−2≤41.
Since p1=21, it follows that pn≥41. We can now bound Φn(a). We have
Φn(a)=d∣n∏(an/d−1)μ(d)=a∑d∣n(n/d)μ(d)d∣n∏(1−a−n/d)μ(d)≥aϕ(n)i=1∏n(1−a−i)≥aϕ(n)i=1∏n(1−2−i)≥41aϕ(n).□
Lemma 7. The only solutions to aϕ(n)≤4n, where a≥2 and n≥3 are integers, are (a,n)=(4,4),(3,3),(3,4), and (2,x) where x∈{3,4,5,6,8,12,24}.
Proof. Let f(m)=m2ϕ(m), and note that f is multiplicative. For any prime p and any k≥2,
f(pk)=pk2pk−1(p−1)=p2pk−2(p−1)2f(pk−1)≥p2(p−1)2f(pk−1)≥f(pk−1),
where we have used the fact that 2(p−1)2≥p when p≥2. It is easy to check that f(p)>4 for any prime p≥7. Furthermore, f(n)>4 for n=24,32,52. Thus, if f(n)≤4, then n must be a divisor of 23⋅3⋅5. Noting that f(2)=1,f(4)=1,f(8)=2,f(3)=34, and f(5)=516. From this and the multiplicativity of f, it is easy to see that the only solutions of f(n)≤4 are n=2,3,4,5,6,8,12,24. This shows that n∈{3,4,5,6,8,12,24} are the only solutions for a=2 with n≥3. If a≥3 and ϕ(n)≥4, then naϕ(n)=f(n)⋅(a/2)ϕ(n)>4. Thus, the only possible solutions for a≥3 must satisfy n∈{3,4}. Checking, we see that the only other solutions are (a,n)=(4,4),(3,3),(3,4). □
We can now find all good pairs (a,n) with a≥2 and n≥3. First, note that if (a,n) is a good pair, then for any prime p∣an−1, we must not have ordp(a)=n. Hence, by Lemma 5, we must have vp(Φn(a))≤vp(n). This applies in particular to all primes dividing Φn(a), so Φn(a)≤n.
By Lemma 6, we must then have n≥4aϕ(n). Thus, we see that the pairs in Lemma 7 are the only possible good pairs. Checking these finitely many cases, we find that (2,6) is the only good pair with a≥2 and n≥3, as needed.