Maths Olympiad Prep

Track / Stage 9 / 50 of 52 #2570 of 2604

Problem 2570

IMO P2/P5; hard shortlist
Number theory Difficulty 9.2 Prove it USA TST · United States · 2025

Let nn be a positive integer. Ana and Banana play a game. Banana thinks of a function f:Z→Zf: \mathbb{Z} \to \mathbb{Z} and a prime number pp. He tells Ana that ff is nonconstant, p<100p < 100, and f(x+p)=f(x)f(x+p) = f(x) for all integers xx. Ana's goal is to determine the value of pp. She writes down nn integers x1,…,xnx_1, \dots, x_n. After seeing this list, Banana writes down f(x1),…,f(xn)f(x_1), \dots, f(x_n) in order. Ana wins if she can determine the value of pp from this information. Find the smallest value of nn for which Ana has a winning strategy.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

The answer is n=83+89−1=171n = 83 + 89 - 1 = 171.
In general, if Ana has to decide between periods from the set P:={p1>p2>⋯>pr}\mathcal{P} := \{p_1 > p_2 > \dots > p_r\} of pairwise distinct relatively prime positive integers for r≥3r \ge 3, the answer is p2+p3−1p_2 + p_3 - 1.

### Bound
Suppose for the sake of contradiction that Ana has a winning sequence of integers x1,…,xnx_1, \dots, x_n with n≤p2+p3−2n \le p_2 + p_3 - 2. We will generate contradictions by providing two primes p,q∈Pp, q \in \mathcal{P} and associated nonconstant functions fp,fq:Z→Zf_p, f_q: \mathbb{Z} \to \mathbb{Z} with periods pp and qq respectively such that fp(xi)=fq(xi)f_p(x_i) = f_q(x_i) for all ii.

Claim — There exists a prime r∈Pr \in \mathcal{P} such that for all primes p∈P∖{r}p \in \mathcal{P} \setminus \{r\}, the set of integers {x1,…,xn}\{x_1, \dots, x_n\} forms a complete residue class modulo pp (i.e. for all tt, there exists ii such that xi≡t(modp)x_i \equiv t \pmod{p}).

Claim — Suppose for the sake of contradiction that such rr didn't exist, and there were in fact two primes p,q∈Pp, q \in \mathcal{P} such that {x1,…,xn}\{x_1, \dots, x_n\} did not form a complete residue class modulo either pp or qq. Concretely, consider t,st, s such that there is no ii with xi≡t(modp)x_i \equiv t \pmod{p} and no jj with xj≡s(modq)x_j \equiv s \pmod{q}.
Construct the functions fp,fq:Z→Zf_p, f_q: \mathbb{Z} \to \mathbb{Z} as

fp(x)={0if x≢t(modp)1if x≡t(modp) f_p(x) = \begin{cases} 0 & \text{if } x \not\equiv t \pmod{p} \\ 1 & \text{if } x \equiv t \pmod{p} \end{cases}
and
fq(x)={0if x≢s(modq)1if x≡s(modq). f_q(x) = \begin{cases} 0 & \text{if } x \not\equiv s \pmod{q} \\ 1 & \text{if } x \equiv s \pmod{q} \end{cases}.
We have fp(xi)=fq(xi)=0f_p(x_i) = f_q(x_i) = 0 for all ii, which is the desired contradiction.

Let rr be the prime from the above claim. Let p,qp, q be the largest two primes in P∖{r}\mathcal{P} \setminus \{r\}, so n≤p+q−2n \le p+q-2. Construct the graph GpqG_{pq} with vertex set {x1,…,xn}\{x_1, \dots, x_n\} and edge xi∼xjx_i \sim x_j if p∣xi−xjp \mid x_i - x_j or q∣xi−xjq \mid x_i - x_j. The following claim allows us to construct a pair of bad functions fp,fqf_p, f_q.

Claim — The graph GpqG_{pq} is disconnected.

Proof. Let GpG_p be the graph on vertex set {x1,…,xn}\{x_1, \dots, x_n\} with edge xi∼xjx_i \sim x_j if p∣xi−xjp \mid x_i - x_j. Note that GpG_p is a collection of pp disjoint cliques, one for each residue class modulo pp.

Prune the graph into Gp′G'_p, where each clique KrK_r is replaced by a path of edge-length r−1r-1. Define Gq′G'_q similarly, and let Gpq′G'_{pq} be the union of Gp′G'_p and Gq′G'_q.
Note that GpqG_{pq} and Gpq′G'_{pq} have the exact same connectivity properties. We have
∣E(Gpq′)∣≤∣E(Gp′)∣+∣E(Gq′)∣=(n−p)+(n−q)≤n−2, |E(G'_{pq})| \le |E(G'_p)| + |E(G'_q)| = (n-p) + (n-q) \le n-2,
so Gpq′G'_{pq} is disconnected, as desired. □\Box

Suppose A⊔B={x1,…,xn}A \sqcup B = \{x_1, \dots, x_n\} are sets of disjoint vertices in GpqG_{pq}. Construct the functions fp,fq:Z→Zf_p, f_q : \mathbb{Z} \to \mathbb{Z} as
fp(x)={0if x≡a(modp) for some a∈A1if x≡b(modp) for some b∈B f_p(x) = \begin{cases} 0 & \text{if } x \equiv a \pmod{p} \text{ for some } a \in A \\ 1 & \text{if } x \equiv b \pmod{p} \text{ for some } b \in B \end{cases}
and
fq(x)={0if x≡a(modq) for some a∈A1if x≡b(modq) for some b∈B. f_q(x) = \begin{cases} 0 & \text{if } x \equiv a \pmod{q} \text{ for some } a \in A \\ 1 & \text{if } x \equiv b \pmod{q} \text{ for some } b \in B. \end{cases}
These are well defined due to the fact that p,q∤a−bp, q \nmid a-b for a∈Aa \in A and b∈Bb \in B, and the fact that A⊔BA \sqcup B forms a complete residue class modulo pp. Again, we have fp(xi)=fq(xi)f_p(x_i) = f_q(x_i) for all ii, which is the desired contradiction.

## Construction
Let n=p2+p3−1n = p_2 + p_3 - 1. We claim that Ana has a winning strategy with the selection xi=p1(i−1)x_i = p_1(i-1). Indeed, suppose that Banana writes down the values y1,…,yny_1, \dots, y_n in order. We will show that Ana can always reconstruct pp.

Claim — If y1=⋯=yny_1 = \dots = y_n, then Ana can correctly guess p=p1p = p_1.

Proof. Suppose for the sake of contradiction that p<p1p < p_1. Then, since x1,…,xnx_1, \dots, x_n forms a complete residue class modulo pp, ff must be a constant function, which is the desired contradiction. □\Box

We can now assume that y1,…,yny_1, \dots, y_n are not all equal, which means p≠p1p \ne p_1. Suppose for the sake of contradiction that there are two primes q,r<p1q, r < p_1 with associated nonconstant functions fp,fq:Z→Zf_p, f_q : \mathbb{Z} \to \mathbb{Z} with periods qq and rr respectively, such that fq(xi)=fr(xi)=yif_q(x_i) = f_r(x_i) = y_i for all ii.
The following claim shows that y1,…,yny_1, \dots, y_n must all be equal, which is the desired contradiction.

Claim — Let GG be the graph on vertex set {0,…,q+r−2}\{0, \dots, q+r-2\} with edge i∼ji \sim j if ∣i−j∣∈{q,r}|i-j| \in \{q, r\}. The graph GG is connected.

Proof. Note that GG has q+r−2q+r-2 edges, so it suffices to show that it has no cycles. Suppose for the sake of contradiction it had a cycle c1,…,ckc_1, \dots, c_k with k≥3k \ge 3 and indices taken mod kk.
Suppose first that ci+1−ci=qc_{i+1} - c_i = q. Then, ci+2−ci+1c_{i+2} - c_{i+1} cannot be −q-q (else ci=ci+2c_i = c_{i+2}), it cannot be rr (else ci+2>q+r−2c_{i+2} > q+r-2), so ci+2−ci+1∈{q,−r}c_{i+2} - c_{i+1} \in \{q, -r\}.

ci+1−ci=q  ⟹  ci+2−ci+1∈{q,−r} c_{i+1} - c_i = q \implies c_{i+2} - c_{i+1} \in \{q, -r\}

ci+1−ci=−q  ⟹  ci+2−ci+1∈{−q,r}ci+1−ci=r  ⟹  ci+2−ci+1∈{−q,r}ci+1−ci=−r  ⟹  ci+2−ci+1∈{q,−r}. \begin{align*} c_{i+1} - c_i &= -q \implies c_{i+2} - c_{i+1} \in \{-q, r\} \\ c_{i+1} - c_i &= r \implies c_{i+2} - c_{i+1} \in \{-q, r\} \\ c_{i+1} - c_i &= -r \implies c_{i+2} - c_{i+1} \in \{q, -r\}. \end{align*}
Thus, either all consecutive differences of vertices in the cycle are in {q,−r}\{q, -r\}, or all in {−q,r}\{-q, r\}. Assume the first case, proof is similar for second case.
Let aa be the number of consecutive differences that are qq, and bb be the number that are −r-r. We see that a+b=ka + b = k and qa−rb=0qa - rb = 0. The second condition implies that a≥ra \ge r and b≥qb \ge q, so we have k≥q+rk \ge q + r, which is the desired contradiction since GG has only q+r−1q + r - 1 vertices. □\square

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