Maths Olympiad Prep

Library / /11 of 15

Algebra Difficulty 9.0 Shortlist Prove it IMO

Let pqp \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 n1n \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=qpk=\left\lceil\frac{q}{p}\right\rceil. Note that k2k \geqslant 2.

Lemma 1. If i,ji, j and mm are positive integers such that ijmp|i-j| \leqslant m p then aiajmp\left|a_{i}-a_{j}\right| \leqslant m p.

Proof. By the given condition, if ijp|i-j| \leqslant p then aiajp\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 ini \geqslant n. Then in+p1i \leqslant n+p-1.

Proof. Suppose for contradiction that in+pi \geqslant n+p. Then min(a[ip,i+qp])=ai\min \left(a_{[i-p, i+q-p]}\right)=a_{i}. Since qp(k1)pq-p \leqslant (k-1) p, it follows from Lemma 1 that max(a[ip,i+qp])ai+(k1)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 ini \leqslant n. Then inp+1i \geqslant n-p+1.

Proof. Suppose aja_{j} is minimal over jnqj \geqslant n-q. Then by Lemma 2,jnq+p12, j \leqslant n-q+p-1. So min(a[nq,n])=aj\min \left(a_{[n-q, n]}\right)=a_{j} and aimax(a[nq,n])a_{i} \geqslant \max \left(a_{[n-q, n]}\right), which implies that aiaj+qa_{i} \geqslant a_{j}+q.

Lemma 2 also implies that if jnj \geqslant n then ajmin(a[n,n+p])a_{j} \geqslant \min \left(a_{[n, n+p]}\right). So if i<ji<j, then we have ajaipa_{j} \geqslant a_{i}-p, which contradicts aiaj+qa_{i} \geqslant a_{j}+q. Hence we must have i>ji>j.

The above inequality also gives aiajq>(k1)p\left|a_{i}-a_{j}\right| \geqslant q>(k-1) p, so by Lemma 1 it follows that ij>(k1)p|i-j|>(k-1) p. Therefore i>j+(k1)pnq+(k1)pnp+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 ini \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 ini \leqslant n. By Lemma 3, cnp>cnc_{n-p}>c_{n} for all n>qn>q. Hence cn=max(a[np,n])=max(a[nq,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+pp=cn+qqb_{n}=c_{n+p}-p=c_{n+q}-q. So for n>qn>q we get bn+qp+p=cn+q=bn+qb_{n+q-p}+p=c_{n+q}=b_{n}+q, and hence bn+qp=bn+qpb_{n+q-p}=b_{n}+q-p.

Next note that bn+pan+pbn+pb_{n+p} \leqslant a_{n+p} \leqslant b_{n}+p. So bn+pbnpb_{n+p}-b_{n} \leqslant p for all n>qn>q, and iterating this (qpq-p) times gives bn+p(qp)bnp(qp)b_{n+p(q-p)}-b_{n} \leqslant p(q-p). But using bn+qp=bn+qpb_{n+q-p}=b_{n}+q-p gives bn+p(qp)bn=p(qp)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+qp=bn+qpb_{n+q-p}=b_{n}+q-p. Since pp and qpq-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 nNn \geqslant N. Then p=max(aN1,N+C+p1)min(aN1,N+C)p=\max \left(a_{N-1}, N+C+p-1\right)- \min \left(a_{N-1}, N+C\right). So aN1=N+C+pa_{N-1}=N+C+p or N+C1N+C-1. Similarly, aN1=N+C+qa_{N-1}=N+C+q or N+C1N+C-1. Hence aN1=N+C1a_{N-1}=N+C-1. So, by induction, we have an=n+Ca_{n}=n+C for all positive integers nn. Since a11,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,x1n, 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 pp' is good and qq' is very good with p<q<2pp'<q'<2p', then 2pq2p'-q' is also good.

Proof. Note that 0<qp<p<q0<q'-p'<p'<q'. Let nn be a sufficiently large positive integer. Then for k[n+qp,n+p]k \in [n+q'-p', n+p'], we have akmax(a[n,n+p])pa_{k} \geqslant \max \left(a_{[n, n+p']}\right)-p' and akmax(a[n+qp,n+q])pa_{k} \geqslant \max \left(a_{[n+q'-p', n+q']}\right)-p' since pp' is good, which shows akmax(a[n,n+q])pa_{k} \geqslant \max \left(a_{[n, n+q']}\right)-p'. Similarly we get akmin(a[n,n+q])+pa_{k} \leqslant \min \left(a_{[n, n+q']}\right)+p'.

Therefore, for all k[n+qp,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 (2pq)(2p'-q')-width of n+qpn+q'-p' is at most (min(a[n,n+q])+p)(max(a[n,n+q])p)=2pq(\min \left(a_{[n, n+q']}\right)+p')-(\max \left(a_{[n, n+q']}\right)-p')=2p'-q'. The lemma follows.

Lemma 2. Let pp' be a good number and qq' a very good number with p<qp'<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+qp,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 pp' and qq' 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 pp' is good and qq' is very good with 2p<q2p'<q', then there exists a positive integer rr such that for all sufficiently large nn, we have an+ranra_{n+r}-a_{n} \geqslant r.

Proof. Let r=q2pr=q'-2p', and let ss and tt be as defined in Lemma 2. Then consider the identity
(atan+qp)+(an+p+ran+p)+(an+pas)=atas=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+qp,n+q]t \in [n+q'-p', n+q'], so an+pspa_{n+p'}-s \leqslant p' and atan+qppa_{t}-a_{n+q'-p'} \leqslant p'. Combining these, we get an+p+ran+pq2p=ra_{n+p'+r}-a_{n+p'} \geqslant q'-2p'=r. This proves that an+ranra_{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 pp' such that 2p<q2p'<q.

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

Suppose for contradiction that 2pq2p' \geqslant q. If 2p>q2p'>q, then by Lemma 1, 2pq2p'-q is a good number strictly less than pp', which contradicts minimality of pp'. If 2p=q2p'=q, then p<p<2pp'<p<2p'. So we can apply Lemma 1 with q0=pq_{0}=p to get that 2pp2p'-p is a good number that is strictly less than pp', 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+ranra_{n+r}-a_{n} \geqslant r for nn sufficiently large.

By iterating, we get an+pranpra_{n+pr}-a_{n} \geqslant pr for all sufficiently large nn, and hence it follows that an+pan=pa_{n+p}-a_{n}=p. Similarly we get an+qan=qa_{n+q}-a_{n}=q. As pp and qq are coprime, we deduce that an+1an=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,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.