Olympiad Maths Prep

Track / Stage 10 / 2 of 40 #1962 of 2000

Problem 1962

Hardest shortlist tier
Number theory Difficulty 9.2 Prove it USA TST 2025 · United States · 2025

Let nn be a positive integer. Ana and Banana play a game. Banana thinks of a function f:ZZf: \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, read the official solution, then mark yourself honestly — the ladder only means something if the record is true.

Official solution

The answer is n=83+891=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 r3r \ge 3, the answer is p2+p31p_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 np2+p32n \le p_2 + p_3 - 2. We will generate contradictions by providing two primes p,qPp, q \in \mathcal{P} and associated nonconstant functions fp,fq:ZZf_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 rPr \in \mathcal{P} such that for all primes pP{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 xit(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,qPp, 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 xit(modp)x_i \equiv t \pmod{p} and no jj with xjs(modq)x_j \equiv s \pmod{q}.
Construct the functions fp,fq:ZZf_p, f_q: \mathbb{Z} \to \mathbb{Z} as

fp(x)={0if x≢t(modp)1if xt(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 xs(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 np+q2n \le p+q-2. Construct the graph GpqG_{pq} with vertex set {x1,,xn}\{x_1, \dots, x_n\} and edge xixjx_i \sim x_j if pxixjp \mid x_i - x_j or qxixjq \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 xixjx_i \sim x_j if pxixjp \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 GpG'_p, where each clique KrK_r is replaced by a path of edge-length r1r-1. Define GqG'_q similarly, and let GpqG'_{pq} be the union of GpG'_p and GqG'_q.
Note that GpqG_{pq} and GpqG'_{pq} have the exact same connectivity properties. We have
E(Gpq)E(Gp)+E(Gq)=(np)+(nq)n2, |E(G'_{pq})| \le |E(G'_p)| + |E(G'_q)| = (n-p) + (n-q) \le n-2,
so GpqG'_{pq} is disconnected, as desired. \Box

Suppose AB={x1,,xn}A \sqcup B = \{x_1, \dots, x_n\} are sets of disjoint vertices in GpqG_{pq}. Construct the functions fp,fq:ZZf_p, f_q : \mathbb{Z} \to \mathbb{Z} as
fp(x)={0if xa(modp) for some aA1if xb(modp) for some bB 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 xa(modq) for some aA1if xb(modq) for some bB. 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,qabp, q \nmid a-b for aAa \in A and bBb \in B, and the fact that ABA \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+p31n = p_2 + p_3 - 1. We claim that Ana has a winning strategy with the selection xi=p1(i1)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 pp1p \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:ZZf_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+r2}\{0, \dots, q+r-2\} with edge iji \sim j if ij{q,r}|i-j| \in \{q, r\}. The graph GG is connected.

*Proof.* Note that GG has q+r2q+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 k3k \ge 3 and indices taken mod kk.
Suppose first that ci+1ci=qc_{i+1} - c_i = q. Then, ci+2ci+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+r2c_{i+2} > q+r-2), so ci+2ci+1{q,r}c_{i+2} - c_{i+1} \in \{q, -r\}.

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

ci+1ci=q    ci+2ci+1{q,r}ci+1ci=r    ci+2ci+1{q,r}ci+1ci=r    ci+2ci+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 qarb=0qa - rb = 0. The second condition implies that ara \ge r and bqb \ge q, so we have kq+rk \ge q + r, which is the desired contradiction since GG has only q+r1q + r - 1 vertices. \square

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.