1. Assume for contradiction: Suppose a=b. Then, b−a has finitely many prime divisors.
2. Lemma I: There exists an odd prime p>b>a such that 4∤ap+p and gcd(ap+p,b−a)≤2.
Proof of Lemma I:
- Let p be an odd prime. If a is even and p is odd, then 4∤ap+p.
- If a≡±1(mod4), choose p≡a(mod4). Thus, there exists an odd prime p for which 4∤ap+p.
- Now, we prove the second part of Lemma I. Let q be an odd prime divisor of b−a. For all q, if a≡1(modq), let p≡1(modq), then ap+p≡2(modq).
- Otherwise, if a≡1(modq), let p≡−1(modq), so ap+p≡ap−1(modq).
- Assume for contradiction that q∣ap−1. Then, either ordq(a)=1 or ordq(a)=p. In the former case, this means a≡1(modq), contradiction. In the latter case, this gives us q≡1(modp), contradiction, since p>q, as p≡−1(modq).
- Hence, by Dirichlet's Theorem of Arithmetic Progression together with the Chinese Remainder Theorem, we find that there exists an odd prime p>b>a such that gcd(ap+p,b−a) has no prime factors other than possibly 2, and since we can choose p such that 4∤ap+p, it follows that gcd(ap+p,b−a)≤2, as desired. ■
3. Using Lemma I: Let n=p, where p is an odd prime which satisfies the conditions in Lemma I, so we have ap+p∣bp−ap.
4. Prime divisor analysis: Let q be a prime divisor of ap+p. If q∣b, then q∣a, so q∣p, which means that q=p. However, p>a, therefore we must have q∤a,b.
5. Order analysis: Then, q∣(ba−1)p−1, so ordq(ba−1)=1 or ordq(ba−1)=p. In the former case, we obtain q∣b−a, however, since gcd(ap+p,b−a)≤2, this implies q=2. In the latter case, this implies q≡1(modp), so for all primes q∣ap+p, either q=2 or q≡1(modp), and also 4∤ap+p, hence we must have either ap+p≡1(modp) or ap+p≡2(modp), or, equivalently, a≡1(modp) or a≡2(modp). Since p>b>a, this is only possible if a=1 or a=2.
6. Case analysis:
- If a=1, then if any prime q∣b, setting n=q−1, we obtain q∣bq−1+q−1≡−1(modq), contradiction. Hence, b cannot have any prime divisors, so b=1.
- If a=2, then ap+p is odd, so gcd(ap+p,b−a)=gcd(2p+p,b−2)=1. Then, we have ap+p=2p+p∣bp−ap=bp−2p. Let q be a prime divisor of 2p+p. Note that q must be odd. If q∣b, then q∣2, so q=2, contradiction. As a result, q∤b, then q∣(b⋅2−1)p−1, therefore ordq(b⋅2−1)=1 or ordq(b⋅2−1)=p. In the former case, this gives us q∣b−2, but this is impossible since gcd(2p+p,b−2)=1. In the latter case, this implies q≡1(modp), so for all primes q∣2p+p, q≡1(modp), so this gives us 2p+p≡1(modp), but we also have 2p+p≡2(modp), contradiction.
7. Conclusion: Then, the initial assumption that b=a must be wrong, so we find that b=a.
■
The final answer is a=b.