Maths Olympiad Prep

Library / HMMT November /561 of 672

HMMT November, 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,b≤104a, b \leq 10^{4} and
gcd⁡(a⋅n!−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 1≤n≤p−11 \leq n \leq p-1 be an integer. Then, n!(p−1−n)!≡(−1)n−1( mod p)n!(p-1-n)!\equiv(-1)^{n-1}(\bmod p).

Proof. Write
n!(p−n−1)!=(1⋅2⋯n)((p−n−1)⋯2⋅1)≡(−1)p−n−1(1⋅2⋯n)((n+1)⋯(p−2)(p−1))( mod p)=(−1)n(p−1)!≡(−1)n−1( mod p) \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 a⋅n!−1a \cdot n!-1 and a⋅(n+1)!+ba \cdot(n+1)!+b. Then, since
−b≡a⋅(n+1)!≡(n+1)⋅(a⋅n!)≡(n+1)( mod p) -b \equiv a \cdot(n+1)!\equiv(n+1) \cdot(a \cdot n!) \equiv(n+1) \quad(\bmod p)
we get that p∣n+b+1p \mid n+b+1. Since we must have n<pn<p (or else p∣n!p \mid n! ), we get that, for large enough nn, n=p−b−1n=p-b-1. However, by the lemma,
a(−1)b−1≡a⋅b!(p−1−b)!=a⋅b!n!≡b!( mod p) 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)b−1b!a=(-1)^{b-1} b!. This forces all fantastic pairs to be in form ((2k−1)!,2k−1)((2 k-1)!, 2 k-1).

Now, we prove that these pairs all work. Take n=p−2kn=p-2 k for all large primes pp. Then, we have
a⋅n!≡(2k−1)!(p−2k)!≡(−1)2k≡1( mod p)a⋅(n+1)!≡(n+1)⋅(a⋅n!)≡(p−2k+1)⋅1≡−(2k−1)( mod p) \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,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

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