Maths Olympiad Prep

Library / IMO Shortlist /312 of 365

IMO Shortlist

Algebra Difficulty 9.0 Shortlist Prove it IMO

Let p≠qp \neq q be coprime positive integers. Determine all infinite sequences a1,a2,…a_{1}, a_{2}, \ldots of positive integers such that the following conditions hold for all n⩾1n \geqslant 1:
max⁡(an,an+1,…,an+p)−min⁡(an,an+1,…,an+p)=p and max⁡(an,an+1,…,an+q)−min⁡(an,an+1,…,an+q)=q. \begin{aligned} & \max \left(a_{n}, a_{n+1}, \ldots, a_{n+p}\right)-\min \left(a_{n}, a_{n+1}, \ldots, a_{n+p}\right)=p \quad \text{ and } \\ & \max \left(a_{n}, a_{n+1}, \ldots, a_{n+q}\right)-\min \left(a_{n}, a_{n+1}, \ldots, a_{n+q}\right)=q . \end{aligned}

Solutions — 2

Solution 1

Answer: The only such sequences are an=n+Ca_{n}=n+C, where CC is a nonnegative integer.

## Common remarks.
- Denote by a[i,j]a_{[i, j]} the subsequence ai,ai+1,…,aja_{i}, a_{i+1}, \ldots, a_{j}.
- Without loss of generality, in each solution we suppose p<qp<q. It can be convenient to treat the case where p=1p=1 separately.
- The problem can also be posed for sequences of arbitrary integers (rather than positive). Refer to the comment after Solution 1 for a proof.

Solution 1. Let k=⌈qp⌉k=\left\lceil\frac{q}{p}\right\rceil. Note that k⩾2k \geqslant 2.

Lemma 1. If i,ji, j and mm are positive integers such that ∣i−j∣⩽mp|i-j| \leqslant m p then ∣ai−aj∣⩽mp\left|a_{i}-a_{j}\right| \leqslant m p.

Proof. By the given condition, if ∣i−j∣⩽p|i-j| \leqslant p then ∣ai−aj∣⩽p\left|a_{i}-a_{j}\right| \leqslant p. So the lemma follows from induction on mm and the triangle inequality.

Lemma 2. For a fixed nn, suppose that aia_{i} is minimal over i⩾ni \geqslant n. Then i⩽n+p−1i \leqslant n+p-1.

Proof. Suppose for contradiction that i⩾n+pi \geqslant n+p. Then min⁡(a[i−p,i+q−p])=ai\min \left(a_{[i-p, i+q-p]}\right)=a_{i}. Since q−p⩽(k−1)pq-p \leqslant (k-1) p, it follows from Lemma 1 that max⁡(a[i−p,i+q−p])⩽ai+(k−1)p<ai+q\max \left(a_{[i-p, i+q-p]}\right) \leqslant a_{i}+(k-1) p<a_{i}+q, which is a contradiction.

Lemma 3. For a fixed n>qn>q, suppose that aia_{i} is maximal over i⩽ni \leqslant n. Then i⩾n−p+1i \geqslant n-p+1.

Proof. Suppose aja_{j} is minimal over j⩾n−qj \geqslant n-q. Then by Lemma 2,j⩽n−q+p−12, j \leqslant n-q+p-1. So min⁡(a[n−q,n])=aj\min \left(a_{[n-q, n]}\right)=a_{j} and ai⩾max⁡(a[n−q,n])a_{i} \geqslant \max \left(a_{[n-q, n]}\right), which implies that ai⩾aj+qa_{i} \geqslant a_{j}+q.

Lemma 2 also implies that if j⩾nj \geqslant n then aj⩾min⁡(a[n,n+p])a_{j} \geqslant \min \left(a_{[n, n+p]}\right). So if i<ji<j, then we have aj⩾ai−pa_{j} \geqslant a_{i}-p, which contradicts ai⩾aj+qa_{i} \geqslant a_{j}+q. Hence we must have i>ji>j.

The above inequality also gives ∣ai−aj∣⩾q>(k−1)p\left|a_{i}-a_{j}\right| \geqslant q>(k-1) p, so by Lemma 1 it follows that ∣i−j∣>(k−1)p|i-j|>(k-1) p. Therefore i>j+(k−1)p⩾n−q+(k−1)p⩾n−p+1i>j+(k-1) p \geqslant n-q+(k-1) p \geqslant n-p+1.

Let bnb_{n} be the minimal value of aia_{i} for i⩾ni \geqslant n. By Lemma 2, bn+p>bnb_{n+p}>b_{n} for all nn. Hence bn=min⁡(a[n,n+p])=min⁡(a[n,n+q])b_{n}=\min \left(a_{[n, n+p]}\right)=\min \left(a_{[n, n+q]}\right). Let cnc_{n} be the maximal value of aia_{i} for i⩽ni \leqslant n. By Lemma 3, cn−p>cnc_{n-p}>c_{n} for all n>qn>q. Hence cn=max⁡(a[n−p,n])=max⁡(a[n−q,n])c_{n}=\max \left(a_{[n-p, n]}\right)=\max \left(a_{[n-q, n]}\right) for n>qn>q.

So if n>qn>q then bn=cn+p−p=cn+q−qb_{n}=c_{n+p}-p=c_{n+q}-q. So for n>qn>q we get bn+q−p+p=cn+q=bn+qb_{n+q-p}+p=c_{n+q}=b_{n}+q, and hence bn+q−p=bn+q−pb_{n+q-p}=b_{n}+q-p.

Next note that bn+p⩽an+p⩽bn+pb_{n+p} \leqslant a_{n+p} \leqslant b_{n}+p. So bn+p−bn⩽pb_{n+p}-b_{n} \leqslant p for all n>qn>q, and iterating this (q−pq-p) times gives bn+p(q−p)−bn⩽p(q−p)b_{n+p(q-p)}-b_{n} \leqslant p(q-p). But using bn+q−p=bn+q−pb_{n+q-p}=b_{n}+q-p gives bn+p(q−p)−bn=p(q−p)b_{n+p(q-p)}-b_{n}=p(q-p). Since equality occurs, we must have bn+p=bn+pb_{n+p}=b_{n}+p.

So for n>q,bn+p=bn+pn>q, b_{n+p}=b_{n}+p and bn+q−p=bn+q−pb_{n+q-p}=b_{n}+q-p. Since pp and q−pq-p are coprime, bn+1=bn+1b_{n+1}=b_{n}+1 for all n>qn>q. The only way for bnb_{n} and bn+1b_{n+1} to be different is if bn=anb_{n}=a_{n}, so we deduce that an+1=an+1a_{n+1}=a_{n}+1 and there is a constant CC such that an=n+Ca_{n}=n+C for all n>qn>q.

Finally, suppose an=n+Ca_{n}=n+C for all n⩾Nn \geqslant N. Then p=max⁡(aN−1,N+C+p−1)−min⁡(aN−1,N+C)p=\max \left(a_{N-1}, N+C+p-1\right)- \min \left(a_{N-1}, N+C\right). So aN−1=N+C+pa_{N-1}=N+C+p or N+C−1N+C-1. Similarly, aN−1=N+C+qa_{N-1}=N+C+q or N+C−1N+C-1. Hence aN−1=N+C−1a_{N-1}=N+C-1. So, by induction, we have an=n+Ca_{n}=n+C for all positive integers nn. Since a1⩾1,Ca_{1} \geqslant 1, C is a nonnegative integer.

It is trivial to check that an=n+Ca_{n}=n+C satisfies the given condition.

Solution 2

For n,x⩾1n, x \geqslant 1, let the xx-width of nn be max⁡(a[n,n+x])−min⁡(a[n,n+x])\max \left(a_{[n, n+x]}\right)-\min \left(a_{[n, n+x]}\right). We call a positive integer xx good if the xx-width of nn is less than or equal to xx for all sufficiently large nn, and we call xx very good if the xx-width of nn is equal to xx for sufficiently large nn.

Lemma 1. If p′p' is good and q′q' is very good with p′<q′<2p′p'<q'<2p', then 2p′−q′2p'-q' is also good.

Proof. Note that 0<q′−p′<p′<q′0<q'-p'<p'<q'. Let nn be a sufficiently large positive integer. Then for k∈[n+q′−p′,n+p′]k \in [n+q'-p', n+p'], we have ak⩾max⁡(a[n,n+p′])−p′a_{k} \geqslant \max \left(a_{[n, n+p']}\right)-p' and ak⩾max⁡(a[n+q′−p′,n+q′])−p′a_{k} \geqslant \max \left(a_{[n+q'-p', n+q']}\right)-p' since p′p' is good, which shows ak⩾max⁡(a[n,n+q′])−p′a_{k} \geqslant \max \left(a_{[n, n+q']}\right)-p'. Similarly we get ak⩽min⁡(a[n,n+q′])+p′a_{k} \leqslant \min \left(a_{[n, n+q']}\right)+p'.

Therefore, for all k∈[n+q′−p′,n+p′]k \in [n+q'-p', n+p'] we have ak∈[max⁡(a[n,n+q′])−p′,min⁡(a[n,n+q′])+p′]a_{k} \in [\max \left(a_{[n, n+q']}\right)-p', \min \left(a_{[n, n+q']}\right)+p']. Thus, the (2p′−q′)(2p'-q')-width of n+q′−p′n+q'-p' is at most (min⁡(a[n,n+q′])+p′)−(max⁡(a[n,n+q′])−p′)=2p′−q′(\min \left(a_{[n, n+q']}\right)+p')-(\max \left(a_{[n, n+q']}\right)-p')=2p'-q'. The lemma follows.

Lemma 2. Let p′p' be a good number and q′q' a very good number with p′<q′p'<q'. For sufficiently large nn, take s,t∈[n,n+q′]s, t \in [n, n+q'] such that min⁡(a[n,n+q′])=as\min \left(a_{[n, n+q']}\right)=a_{s} and max⁡(a[n,n+q′])=at\max \left(a_{[n, n+q']}\right)=a_{t}. Then s∈[n,n+p′]s \in [n, n+p'] and t∈[n+q′−p′,n+q′]t \in [n+q'-p', n+q'].

Proof. Lemma 2 and Lemma 3 from Solution 1 hold with pp and qq replaced by p′p' and q′q' by similar arguments. We can deduce the statement about ss from Lemma 2 of Solution 1. We can deduce the statement about tt from Lemma 3 of Solution 1.

Lemma 3. If p′p' is good and q′q' is very good with 2p′<q′2p'<q', then there exists a positive integer rr such that for all sufficiently large nn, we have an+r−an⩾ra_{n+r}-a_{n} \geqslant r.

Proof. Let r=q′−2p′r=q'-2p', and let ss and tt be as defined in Lemma 2. Then consider the identity
(at−an+q′−p′)+(an+p′+r−an+p′)+(an+p′−as)=at−as=q′ \left(a_{t}-a_{n+q'-p'}\right)+\left(a_{n+p'+r}-a_{n+p'}\right)+\left(a_{n+p'}-a_{s}\right)=a_{t}-a_{s}=q'
By Lemma 2, we have s∈[n,n+p′]s \in [n, n+p'] and t∈[n+q′−p′,n+q′]t \in [n+q'-p', n+q'], so an+p′−s⩽p′a_{n+p'}-s \leqslant p' and at−an+q′−p′⩽p′a_{t}-a_{n+q'-p'} \leqslant p'. Combining these, we get an+p′+r−an+p′⩾q′−2p′=ra_{n+p'+r}-a_{n+p'} \geqslant q'-2p'=r. This proves that an+r−an⩾ra_{n+r}-a_{n} \geqslant r for sufficiently large nn.

Lemma 4. Suppose (p,q)≠(1,2)(p, q) \neq (1,2). Then there exists a good number p′p' such that 2p′<q2p'<q.

Proof. Let p′p' be the smallest good positive integer. Note that pp is good, so p′p' exists and is less than qq.

Suppose for contradiction that 2p′⩾q2p' \geqslant q. If 2p′>q2p'>q, then by Lemma 1, 2p′−q2p'-q is a good number strictly less than p′p', which contradicts minimality of p′p'. If 2p′=q2p'=q, then p′<p<2p′p'<p<2p'. So we can apply Lemma 1 with q0=pq_{0}=p to get that 2p′−p2p'-p is a good number that is strictly less than p′p', which again contradicts minimality.

If (p,q)=(1,2)(p, q)=(1,2) then the problem is easily solved. Otherwise, Lemmas 3 and 4 combined give us some r>0r>0 such that an+r−an⩾ra_{n+r}-a_{n} \geqslant r for nn sufficiently large.

By iterating, we get an+pr−an⩾pra_{n+pr}-a_{n} \geqslant pr for all sufficiently large nn, and hence it follows that an+p−an=pa_{n+p}-a_{n}=p. Similarly we get an+q−an=qa_{n+q}-a_{n}=q. As pp and qq are coprime, we deduce that an+1−an=1a_{n+1}-a_{n}=1 for sufficiently large nn. Thus we get an=n+Ca_{n}=n+C for sufficiently large nn, and we can conclude by the same argument as Solution 1.

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.