Maths Olympiad Prep

Library / /623 of 740

, 2022

Number theory Difficulty 5.4 AIME, harder Prove it United States

Problem:

Call an ordered pair (a,b)(a, b) of positive integers fantastic if and only if a,b104a, b \leq 10^{4} and
gcd(an!1,a(n+1)!+b)>1 \operatorname{gcd}(a \cdot n!-1, a \cdot(n+1)!+b)>1
for infinitely many positive integers nn. Find the sum of a+ba+b across all fantastic pairs (a,b)(a, b).

Solution

Solution:

We first prove the following lemma, which will be useful later.

Lemma: Let pp be a prime and 1np11 \leq n \leq p-1 be an integer. Then, n!(p1n)!(1)n1(modp)n!(p-1-n)!\equiv(-1)^{n-1}(\bmod p).

Proof. Write
n!(pn1)!=(12n)((pn1)21)(1)pn1(12n)((n+1)(p2)(p1))(modp)=(1)n(p1)!(1)n1(modp) \begin{aligned} n!(p-n-1)! & =(1 \cdot 2 \cdots n)((p-n-1) \cdots 2 \cdot 1) \\ & \equiv(-1)^{p-n-1}(1 \cdot 2 \cdots n)((n+1) \cdots(p-2)(p-1)) \quad(\bmod p) \\ & =(-1)^{n}(p-1)! \\ & \equiv(-1)^{n-1} \quad(\bmod p) \end{aligned}
(where we have used Wilson's theorem). This implies the result.

Now, we begin the solution. Suppose that a prime pp divides both an!1a \cdot n!-1 and a(n+1)!+ba \cdot(n+1)!+b. Then, since
ba(n+1)!(n+1)(an!)(n+1)(modp) -b \equiv a \cdot(n+1)!\equiv(n+1) \cdot(a \cdot n!) \equiv(n+1) \quad(\bmod p)
we get that pn+b+1p \mid n+b+1. Since we must have n<pn<p (or else pn!p \mid n! ), we get that, for large enough nn, n=pb1n=p-b-1. However, by the lemma,
a(1)b1ab!(p1b)!=ab!n!b!(modp) a(-1)^{b-1} \equiv a \cdot b!(p-1-b)!=a \cdot b!n!\equiv b!\quad(\bmod p)
This must hold for infinitely many pp, so a=(1)b1b!a=(-1)^{b-1} b!. This forces all fantastic pairs to be in form ((2k1)!,2k1)((2 k-1)!, 2 k-1).

Now, we prove that these pairs all work. Take n=p2kn=p-2 k for all large primes pp. Then, we have
an!(2k1)!(p2k)!(1)2k1(modp)a(n+1)!(n+1)(an!)(p2k+1)1(2k1)(modp) \begin{aligned} a \cdot n! & \equiv(2 k-1)!(p-2 k)! \\ & \equiv(-1)^{2 k} \equiv 1 \quad(\bmod p) \\ a \cdot(n+1)! & \equiv(n+1) \cdot(a \cdot n!) \\ & \equiv(p-2 k+1) \cdot 1 \equiv-(2 k-1) \quad(\bmod p) \end{aligned}
so pp divides the gcd.

The answer is (1+1)+(6+3)+(120+5)+(5040+7)=5183(1+1)+(6+3)+(120+5)+(5040+7)=5183.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.