Maths Olympiad Prep

Library / /85 of 106

Number theory Difficulty 8.8 Shortlist Prove it IMO

Let pp be an odd prime number and Z>0\mathbb{Z}_{>0} be the set of positive integers. Suppose that a function f:Z>0×Z>0{0,1}f: \mathbb{Z}_{>0} \times \mathbb{Z}_{>0} \rightarrow \{0,1\} satisfies the following properties:
- f(1,1)=0f(1,1)=0;
- f(a,b)+f(b,a)=1f(a, b)+f(b, a)=1 for any pair of relatively prime positive integers (a,b)(a, b) not both equal to 11;
- f(a+b,b)=f(a,b)f(a+b, b)=f(a, b) for any pair of relatively prime positive integers (a,b)(a, b).
Prove that
n=1p1f(n2,p)2p2. \sum_{n=1}^{p-1} f\left(n^{2}, p\right) \geqslant \sqrt{2 p}-2 .

Solutions — 2

Solution 1

Denote by A\mathbb{A} the set of all pairs of coprime positive integers. Notice that for every (a,b)A(a, b) \in \mathbb{A} there exists a pair (u,v)Z2(u, v) \in \mathbb{Z}^{2} with ua+vb=1u a+v b=1. Moreover, if (u0,v0)(u_{0}, v_{0}) is one such pair, then all such pairs are of the form (u,v)=(u0+kb,v0ka)(u, v)=\left(u_{0}+k b, v_{0}-k a\right), where kZk \in \mathbb{Z}. So there exists a unique such pair (u,v)(u, v) with b/2<ub/2-b / 2<u \leqslant b / 2; we denote this pair by (u,v)=g(a,b)(u, v)=g(a, b).

Lemma. Let (a,b)A(a, b) \in \mathbb{A} and (u,v)=g(a,b)(u, v)=g(a, b). Then f(a,b)=1u>0f(a, b)=1 \Longleftrightarrow u>0.

Proof. We induct on a+ba+b. The base case is a+b=2a+b=2. In this case, we have that a=b=1a=b=1, g(a,b)=g(1,1)=(0,1)g(a, b)=g(1,1)=(0,1) and f(1,1)=0f(1,1)=0, so the claim holds.

Assume now that a+b>2a+b>2, and so aba \neq b, since aa and bb are coprime. Two cases are possible.

Case 1: a>ba>b.
Notice that g(ab,b)=(u,v+u)g(a-b, b)=(u, v+u), since u(ab)+(v+u)b=1u(a-b)+(v+u) b=1 and u(b/2,b/2]u \in(-b / 2, b / 2]. Thus f(a,b)=1f(ab,b)=1u>0f(a, b)=1 \Longleftrightarrow f(a-b, b)=1 \Longleftrightarrow u>0 by the induction hypothesis.

Case 2: a<ba<b. (Then, clearly, b2b \geqslant 2.)
Now we estimate vv. Since vb=1uav b=1-u a, we have
1+ab2>vb1ab2, so 1+a21b+a2>v1ba2>a2. 1+\frac{a b}{2}>v b \geqslant 1-\frac{a b}{2}, \quad \text{ so } \quad \frac{1+a}{2} \geqslant \frac{1}{b}+\frac{a}{2}>v \geqslant \frac{1}{b}-\frac{a}{2}>-\frac{a}{2} .
Thus 1+a>2v>a1+a>2 v>-a, so a2v>aa \geqslant 2 v>-a, hence a/2v>a/2a / 2 \geqslant v>-a / 2, and thus g(b,a)=(v,u)g(b, a)=(v, u).

Observe that f(a,b)=1f(b,a)=0f(ba,a)=0f(a, b)=1 \Longleftrightarrow f(b, a)=0 \Longleftrightarrow f(b-a, a)=0. We know from Case 1 that g(ba,a)=(v,u+v)g(b-a, a)=(v, u+v). We have f(ba,a)=0v0f(b-a, a)=0 \Longleftrightarrow v \leqslant 0 by the inductive hypothesis. Then, since b>a1b>a \geqslant 1 and ua+vb=1u a+v b=1, we have v0u>0v \leqslant 0 \Longleftrightarrow u>0, and we are done.

The Lemma proves that, for all (a,b)A(a, b) \in \mathbb{A}, f(a,b)=1f(a, b)=1 if and only if the inverse of aa modulo bb, taken in {1,2,,b1}\{1,2, \ldots, b-1\}, is at most b/2b / 2. Then, for any odd prime pp and integer nn such that n≢0(modp)n \not \equiv 0(\bmod p), f(n2,p)=1f\left(n^{2}, p\right)=1 iff the inverse of n2modpn^{2} \bmod p is less than p/2p / 2. Since {n2modp:1np1}={n2modp:1np1}\left\{n^{2} \bmod p: 1 \leqslant n \leqslant p-1\right\}=\left\{n^{-2} \bmod p: 1 \leqslant n \leqslant p-1\right\}, including multiplicities (two for each quadratic residue in each set), we conclude that the desired sum is twice the number of quadratic residues that are less than p/2p / 2, i.e.,
n=1p1f(n2,p)=2{k:1kp12 and k2modp<p2}. \left.\sum_{n=1}^{p-1} f\left(n^{2}, p\right)=2 \left\lvert\,\left\{k: 1 \leqslant k \leqslant \frac{p-1}{2} \text{ and } k^{2} \bmod p<\frac{p}{2}\right\}\right. \right\rvert\, .
Since the number of perfect squares in the interval [1,p/2)[1, p / 2) is p/2>p/21\lfloor\sqrt{p / 2}\rfloor>\sqrt{p / 2}-1, we conclude that
n=1p1f(n2,p)>2(p21)=2p2. \sum_{n=1}^{p-1} f\left(n^{2}, p\right)>2\left(\sqrt{\frac{p}{2}}-1\right)=\sqrt{2 p}-2 .

Solution 2

We provide a different proof for the Lemma. For this purpose, we use continued fractions to find g(a,b)=(u,v)g(a, b)=(u, v) explicitly.

The function ff is completely determined on A\mathbb{A} by the following

Claim. Represent a/ba / b as a continued fraction; that is, let a0a_{0} be an integer and a1,,aka_{1}, \ldots, a_{k} be positive integers such that ak2a_{k} \geqslant 2 and
ab=a0+1a1+1a2+1+1ak=[a0;a1,a2,,ak]. \frac{a}{b}=a_{0}+\frac{1}{a_{1}+\frac{1}{a_{2}+\frac{1}{\cdots+\frac{1}{a_{k}}}}}=\left[a_{0} ; a_{1}, a_{2}, \ldots, a_{k}\right] .
Then f(a,b)=0kf(a, b)=0 \Longleftrightarrow k is even.

Proof. We induct on bb. If b=1b=1, then a/b=[a]a / b=[a] and k=0k=0. Then, for a1a \geqslant 1, an easy induction shows that f(a,1)=f(1,1)=0f(a, 1)=f(1,1)=0.

Now consider the case b>1b>1. Perform the Euclidean division a=qb+ra=q b+r, with 0r<b0 \leqslant r<b. We have r0r \neq 0 because gcd(a,b)=1\operatorname{gcd}(a, b)=1. Hence
f(a,b)=f(r,b)=1f(b,r),ab=[q;a1,,ak], and br=[a1;a2,,ak]. f(a, b)=f(r, b)=1-f(b, r), \quad \frac{a}{b}=\left[q ; a_{1}, \ldots, a_{k}\right], \quad \text{ and } \quad \frac{b}{r}=\left[a_{1} ; a_{2}, \ldots, a_{k}\right] .
Then the number of terms in the continued fraction representations of a/ba / b and b/rb / r differ by one. Since r<br<b, the inductive hypothesis yields
f(b,r)=0k1 is even,  f(b, r)=0 \Longleftrightarrow k-1 \text{ is even, }
and thus
f(a,b)=0f(b,r)=1k1 is odd k is even.  f(a, b)=0 \Longleftrightarrow f(b, r)=1 \Longleftrightarrow k-1 \text{ is odd } \Longleftrightarrow k \text{ is even. }
\square

Now we use the following well-known properties of continued fractions to prove the Lemma:
Let pip_{i} and qiq_{i} be coprime positive integers with [a0;a1,a2,,ai]=pi/qi\left[a_{0} ; a_{1}, a_{2}, \ldots, a_{i}\right]=p_{i} / q_{i}, with the notation borrowed from the Claim. In particular, a/b=[a0;a1,a2,,ak]=pk/qka / b=\left[a_{0} ; a_{1}, a_{2}, \ldots, a_{k}\right]=p_{k} / q_{k}. Assume that k>0k>0 and define q1=0q_{-1}=0 if necessary. Then
- qk=akqk1+qk2q_{k}=a_{k} q_{k-1}+q_{k-2}, \quad and
- aqk1bpk1=pkqk1qkpk1=(1)k1a q_{k-1}-b p_{k-1}=p_{k} q_{k-1}-q_{k} p_{k-1}=(-1)^{k-1}.

Assume that k>0k>0. Then ak2a_{k} \geqslant 2, and
b=qk=akqk1+qk2akqk12qk1qk1b2, b=q_{k}=a_{k} q_{k-1}+q_{k-2} \geqslant a_{k} q_{k-1} \geqslant 2 q_{k-1} \Longrightarrow q_{k-1} \leqslant \frac{b}{2},
with strict inequality for k>1k>1, and
(1)k1qk1a+(1)kpk1b=1. (-1)^{k-1} q_{k-1} a+(-1)^{k} p_{k-1} b=1 .
Now we finish the proof of the Lemma. It is immediate for k=0k=0. If k=1k=1, then (1)k1=1(-1)^{k-1}=1, so
b/2<0(1)k1qk1b/2. -b / 2<0 \leqslant(-1)^{k-1} q_{k-1} \leqslant b / 2 .
If k>1k>1, we have qk1<b/2q_{k-1}<b / 2, so
b/2<(1)k1qk1<b/2. -b / 2<(-1)^{k-1} q_{k-1}<b / 2 .
Thus, for any k>0k>0, we find that g(a,b)=((1)k1qk1,(1)kpk1)g(a, b)=\left((-1)^{k-1} q_{k-1},(-1)^{k} p_{k-1}\right), and so
f(a,b)=1k is odd u=(1)k1qk1>0. f(a, b)=1 \Longleftrightarrow k \text{ is odd } \Longleftrightarrow u=(-1)^{k-1} q_{k-1}>0 .

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 and solution reproduced as published; topic and difficulty added by this site.