Let $a_1,a_2,a_3,\ldots$ be a sequence of integers, with the property that every consecutive group of $a_i$'s averages to a perfect square. More precisely, for every positive integers $n$ and $k$, the quantity \[\frac{a_n+a_{n+1}+\cdots+a_{n+k-1}}{k}\] is always the square of an integer. Prove that the sequence must be constant (all $a_i$ are equal to the same perfect square). Evan O'Dorney and Victor Wang
Problem
Source: USA December TST for IMO 2014, Problem 2
Tags: quadratics, USA(J)MO, USAMO, induction, modular arithmetic, number theory proposed, Quadratic Residues
24.12.2013 07:37
The official solutions can be found in a Dropbox link here.
Edit: linked to IMO 2010 thread with Evan's solution attached.
24.12.2013 07:54
Darn, solved this after TST. Ok, I don't think this exact solution was in the Dropbox link, and if it was I apologize. So assume some prime $p|a_1$. Since $p|a_i+a_{i+1}+...+a_{i+p-1}$ for any $i$, we get $p|a_j \implies p|a_{j \pm p} (*)$ for any $j$. Now take a minimal $k \le p-1$ so that $k$ is the minimal quadratic non-residue. Since both are perfect squares, $\left(\frac{k(a_1+a_2+...+a_k)}{p}\right) = \left(\frac{(k-1)(a_2+a_3+...+a_{k})}{p}\right) \implies \left(\frac{k}{p}\right) = \left(\frac{k-1}{p}\right)$, a contradiction unless $p|a_2+...+a_k$. Now similarly, $\left(\frac{a_{k+1}}{p}\right) = \left(\frac{k(a_2+a_3+...+a_{k+1})}{p}\right) \implies \left(\frac{k}{p}\right) = 1$, a contradiction unless $p|a_{k+1}$. An equivalent argument gives the following: $p|a_j \implies p|a_{j+k}$ for any $j$. Since $\gcd(k, p) = 1$, by $(*)$ above, we can get that $p|a_i$ for any $i$. So divide out the $p$ and repeat the argument again, to get that all the numbers have the same prime factors.
24.12.2013 08:04
Yeah, during the actual TST I only did $k=2$. Darn. Then I somehow thought that for all $(2/p)=-1$, every residue mod $p$ had to be the same, but that's not immediately true. Also, you are supposed to divide out by $p^2$, not $p$. And the same argument does work, but you should be a little more clear about it, because the average of say $p^2$ terms might no longer be an integer (we end up not caring and only averages of at most $p$ terms matter, but still you should mention it).
24.12.2013 23:26
Sorry for changing the conversation, but USAMO is on April, why are you having a TST on december?
24.12.2013 23:29
We have TSTs throughout the year, and the USAMO serves as the final TST.
24.12.2013 23:43
So suppose I'm a contestant, in my first year I have to pass USAMO in order to apply this TSTs?
25.12.2013 00:20
Yes. That is our new system. It is arguably somewhat silly, but it is also arguably effective. More testing throughout the year means a more rigorous program, and this new policy brings the US in line with China and other top nations.
25.12.2013 00:25
Thanks I didn't know that.
29.12.2013 02:05
MexicOMM wrote: Sorry for changing the conversation, but USAMO is on April, why are you having a TST on december? Please see FAQ MOP #5 for the full details. Here was my solution. I got this in a couple hours of English class, but unfortunately I didn't actually take the TST. Let $\nu_p(n)$ denote the largest exponent of $p$ dividing $n$. The problem follows from the following proposition. Proposition. Let $(a_n)$ be a sequence of integers and let $p$ be a prime. Suppose that every consecutive group of $a_i$'s with length at most $p$ averages to a perfect square. Then $\nu_p(a_i)$ is independent of $i$. We proceed by induction on the smallest value of $\nu_p(a_i)$ as $i$ ranges (which must be even, as each of the $a_i$ are themselves a square). First we prove two claims. Claim: If $j \equiv k \pmod p$ then $a_j \equiv a_k \pmod{p}$. Proof: Taking groups of length $p$ in our given, we find that $p \mid a_j +\dots + a_{j+p-1}$ and $p \mid a_{j+1} + \dots + a_{j+p}$ for any $j$. So $a_j \equiv a_{j+p} \pmod p$ and the conclusion follows. $\quad\square$ Claim: If some $a_i$ is divisible by $p$ then all of them are. Proof: The case $p=2$ is trivial so assume $p \ge 3$. Without loss of generality (via shifting indices) assume that $a_1 \equiv 0 \pmod{p}$, and define \[ S_n = a_1 + a_2 + \dots + a_n \equiv a_2 + \dots + a_n \pmod{p}. \] Call an integer $k$ with $2 \le k < p$ a pivot if $1-k^{-1}$ is a nonresidue modulo $p$. We claim that for any pivot $k$, $S_k \equiv 0 \pmod{p}$. If not, then \[ \frac{a_1 + a_2 + \dots + a_k}{k} \text{ and } \frac{a_2 + \dots + a_k}{k-1} \] are both residues. Division implies that $\frac{k-1}{k} = 1 - k\inv$ is a residue, contradiction. Next we claim that there is an integer $m$ with $S_m \equiv S_{m+1} \equiv 0 \pmod{p}$, which implies $p \mid a_{m+1}$. If $2$ is a pivot, then we simply take $m=1$. Otherwise, there are $\frac12(p-1)$ pivots, one for each nonresidue (which includes neither $0$ nor $1$), and all pivots lie in $[3,p-1]$, so we can find an $m$ such that $m$ and $m+1$ are both pivots. Repeating this procedure starting with $a_{m+1}$ shows that $a_{2m+1}, a_{3m+1}, \dots$ must all be divisible by $p$. Combined with the first claim and the fact that $m < p$, we find that all the $a_i$ are divisible by $p$. $\quad\square$ The second claim establishes the base case of our induction. Now assume all $a_i$ are divisible by $p$ and hence $p^2$. Then all the averages in our proposition (with length at most $p$) are divisible by $p$ and hence $p^2$. Thus the map $a_i \mapsto \frac{1}{p^2} a_i$ gives a new sequence satisfying the proposition, and our inductive hypothesis completes the proof. $\quad\blacksquare$
15.01.2014 19:53
My solution. The trick is to use quadratic residues (since a lot of things are squares, a lot of quadratic residues will be 1). Then we prove that if a prime divides a certain term of the sequence, since we want the sequence to be constant, we prove the prime divides every term of the sequence. Then, since every term is a square, the square of the prime divides every term in the sequence. We can divide by it. Then we repeat the process, dividing by primes. Eventually we will reach a sequence where every term must be 1, and we will be finished. So suppose a certain prime divides $a_k$. WLOG $k=1$. Then remember that $k(a_1+...+a_k)$ is a square but also $(k-1)(a_2+...+a_k)$. Since $a_2+...+a_k=a_1+...+a_k$ mod $p$, so if they're not 0 mod $p$, we know that $k$ and $k-1$ are both quadratic residues or non-residues. We can take a small enough $k$ such that this is impossible. This will guarantee that $p | a_2+...+a_k$. Now we use residues again. We know $a_{k+1}$ is a square but also $k(a_2+...+a_{k+1})$. Since $a_{k+1}=(a_2+...+a_{k+1})$ mod $p$, then $k$ must be a quadratic residue. But if we take $k$ the smallest non-residue mod $p$, then this is a contradiction. This guarantees $p | a_{k+1}$ But also $p | a_{p+1}$ trivially. Using bezout we prove $p$ divides everybody, so we're done.
24.02.2014 19:27
If we consider the sequence $b_{i}=\frac{a_{2i-1}+a_{2i}}{2}$ it satisfies the same condition as $a_{i}$. Also if $a_{i}=2^{\alpha}c, 2\nmid c \Rightarrow 2^{\alpha}\mid a_{i\pm1}$ So we can assume $a_{i}$ is odd for any positive integer $i$. We have $b_{i}\equiv b_{i+1}\pmod{8} \Rightarrow b_{i}+b_{i+1}=2c^{2}\equiv 2 \pmod{16}$ as $b_{i}$s and $c$ are odd, hence $b_{i}\equiv b_{i+1} \pmod{16}$. Now considering the sequence $c_{i}^{2}=\frac{b_{2i-1}+b_{2i}}{2}$ we can get the same for it $c_{i}$ so $b_{i}+b_{i+1}\equiv 2c^{2}\equiv 2 \pmod{2^{5}} \Rightarrow b_{i}\equiv b_{i+1} \pmod{2^{5}}$. Analogously, by induction we'll get $b_{i}\equiv b_{i+1}\pmod{2^{m}}$ for any positive integer $m$ which obviously implies $b_{i}=b_{i+1}$.
25.02.2014 05:44
gev_gev wrote: [...] hence $b_{i}\equiv b_{i+1} \pmod{16}$. Now considering the sequence $c_{i}^{2}=\frac{b_{2i-1}+b_{2i}}{2}$ we can get the same for it $c_{i}$ so $b_{i}+b_{i+1}\equiv 2c^{2}\equiv 2 \pmod{2^{5}} \Rightarrow b_{i}\equiv b_{i+1} \pmod{2^{5}}$. This doesn't work. If $b_i =1$ and $b_{i+1}=7^2$, then certainly $\frac{b_i+b_{i+1}}{2} = 5^2$ is a square and $b_i \equiv b_{i+1}\pmod{16}$, but $b_i \not\equiv b_{i+1}\pmod{32}$. (Also, a minor error: we don't know enough at this point to say $2c^2\equiv 2\pmod{2^5}$, only that $2c^2\in\{2,18\}\pmod{2^5}$.) (On a slightly related note, a full solution cannot ignore odd $k\ge3$: consider $1^2,7^2,1^2,7^2,\ldots$. However, it's certainly possible that the evens might reduce the problem to a simple Diophantine in a finite number of variables.)
24.06.2014 14:16
I might be being silly here, but is it true that each of the $a_i$'s are perfect squares (this follows by setting $n=$ anything and $k=1$)? Or any consecutive block of more than 1 $a_i$'s sum up to a square? I think I have found a proof assuming that all $a_i$'s are perfect squares (which is probably true since the condition holds for all positive integers $n,k$). Thanks to dibyo_99 for the help. Claim: If a prime $p$ divides $a_1,$ $p$ divides $a_i$ for all $i.$ Proof: First, let's deal with the case $p=2.$ Since $\dfrac{a_1+a_2}{2} \in \mathbb{Z},$ $2 \mid a_2.$ Again, considering $\dfrac{a_2+a_3}{2},$ $2 \mid a_3.$ Continuing this way, by easy induction it follows that $2 \mid a_n$ for all $n.$ Hereby assume $p>2.$ For some $n,$ let $a_1 + a_2 + \cdots + a_n= nx^2$ and $a_2 + a_3 + \cdots + a_n = (n-1)y^2.$ We have that $nx^2 - (n-1)y^2 = a_1 \equiv 0 \pmod{p}.$ I claim that a suitable choice of $n$ forces $x \equiv y \equiv 0 \pmod{p}.$ If that is not true, we have $\left( xy^{-1} \right) ^2 \equiv (n-1) \cdot n^{-1} \pmod{p},$ so $(n-1) \cdot n^{-1}$ is a quadratic residue $\pmod{p}.$ Note that $(n-1) \cdot n^{-1} \equiv 1 - n^{-1} \pmod{p},$ and the sequence $\{ 1 - n^{-1} \} _ {n=1}^{p}$ is a CRS modulo $p,$ so a suitable choice of $n$ makes $(n-1) \cdot n^{-1}$ a quadratic non-residue modulo $p,$ in which case we must have $p \mid x^2, y^2.$ Case 1: $1 - 2^{-1}$ is quadratic non-residue. This implies $p \mid a_1 + a_2 \implies p \mid a_2.$ Similar arguments (shift the indices left by 1 term) show that $p \mid a_3$ and so on, so $p \mid a_n$ for all $n \in \mathbb{N}.$ [*]Case 2: $1-2^{-1}$ is a quadratic residue. [/*] Before proceeding, we claim that there are precisely $\dfrac{p-1}{2}$ choices for $n$ such that $1 - n^{-1}$ is a quadratic non-residue. Since $1-a^{-1} \equiv 1 - b^{-1} \pmod{p} \iff a \equiv b \pmod{p},$ it suffices to show that there are precisely $\dfrac{p-1}{2}$ quadratic non-residues, or that there are precisely $\dfrac{p+1}{2}$ quadratic residues. This is easy. Note that for all $1 \leq x,y \leq \dfrac{p-1}{2},$ $x^2 \equiv y^2 \pmod{p} \iff x \equiv y \pmod{p}$ since $0 \leq x-y < p$ and $0 < x+y < p,$ and $x^2 \equiv (-x)^2 \pmod{p},$ so we're done. Now, we know that $n=2$ is not a valid option, and $n=0,1$ obviously don't work, so there are only $p-3$ choices for $n.$ However, $n$ takes in precisely $\dfrac{p-1}{2}$ values, so by PHP there must exist a $n$ such that both $1-n^{-1}$ and $1-(n+1)^{-1}$ are quadratic non-residues. In that case, we have \[p \mid a_1 + a_2 + \cdots + a_n \\ p \mid a_1 + a_2 + \cdots + a_{n+1} \\ \implies p \mid a_{n+1}.\]Now, similar arguments show that $p \mid a_{n+1+n}, p \mid a_{n+1+2n}$ and so on (just shift the indices by $n$ terms in each step), so by easy induction, $p \mid a_{kn+1}$ for all $k \in \mathbb{N}.$ Since $\gcd (n+1, p) = 1,$ the sequence $\{kn+1\}_{k=1}^{\infty}$ forms a CRS modulo $p.$ Let's take any such number congruent to $x \pmod{p}.$ Shifting the indices $p$ units to the left, we see that $\cdots , a_{x-2p}, a_{x-p}, a_x, a_{x+p}, a_{x+2p}, \cdots $ are all multiples of $p.$ All positive integers are covered this way, so we're done. We have completed both cases, so we are done. $\blacksquare$ The same arguments apply for any prime dividing $a_k.$ In other words, the set of prime divisors of $a_i$'s are all equal. But, since $a_i$'s are all perfect squares themselves, we see that $p^2 \mid a_i \quad \forall \ i,$ so dividing the whole sequence by the squares of all their prime divisors gives a sequence of the form $(1, 1, 1, \cdots ),$ and renormalizing, we find that $a_1= a_2= \cdots ,$ completing the proof. $\blacksquare$
04.07.2014 07:55
AnonymousBunny wrote: I might be being silly here, but is it true that each of the $a_i$'s are perfect squares (this follows by setting $n=$ anything and $k=1$)? Yes, that is what the problem says.
04.07.2014 08:13
This does bring up a good point: we only need the condition for all sufficiently large $k$ (i.e. all sufficiently long consecutive averages). This is easier to see in the $\frac{f(m)-f(n)}{m-n}$ formulation: it's still easy to show that $f(n)\pmod{p}$ depends only on $n\pmod{p}$, and the same injectivity modulo $p$ argument carries through as before.
01.03.2015 22:20
I need to ask a question and (accept my apology if that seems trivial, I'm a total newbie !) From the assumption of the problem we know that all the elements $a_i$ are square, now taking $a_0$ an $a_1$ we have that $\frac{a_0+a_1}{2} = c^2$ for some integer c. that can be used to parametrize the solution by finding the rational points on a circle of radius $\sqrt{2}$ now we know that the only rational points on a circle (http://math.stackexchange.com/questions/777790/rational-parametrization-of-points-on-sphere-of-irrational-radius) of that radius is the point (1,1) from which we get that $a=b=c$, we can use that to prove that all of the sequence is contant. What I'm doing wrong here??
20.07.2019 09:19
Assume all the terms in this sequence are different. Consider $j$ successive terms such that $j \nmid \sum_{k=0}^{j-1} a_{i+k}$. Notice hence $\sum_{k=0}^{j-1} a_{i+k} = jk^2$. Assume further that $j$ is squarefree. Pick a suitable prime $p$. Then $v_p \bigg (\sum_{k=0}^{j-1} a_{i+k} \bigg )=\text{min} [v_p(a_i,a_{i+1}, \dots a_{i+j-1})]$ Lemma: Each term $a_i$ in this sequence is a square. Proof: Take any one term and hence it is trivial to note that each must be a square. Hence, $\text{min} [v_p(a_i,a_{i+1}, \dots a_{i+j-1})]$ must be even. But $\text{min} [v_p(a_i,a_{i+1}, \dots a_{i+j-1})]=v_p(jk^2)=v_p(j)+v_p(k^2)$. Hence, $v_p(j)$ must be even for all $j$, which is certainly false. Hence, we are done.
20.07.2019 10:26
Mr.Chagol wrote: Then $v_p \bigg (\sum_{k=0}^{j-1} a_{i+k} \bigg )=\text{min} [v_p(a_i,a_{i+1}, \dots a_{i+j-1})]$ This is certainly not true...
20.07.2019 10:52
Does it affect the proof? Each exponent must be even, right?
22.01.2020 20:30
clearly $a_i$ are perfect squares claim: if $p|a_i$ then $p|a_j \forall j \in N$ suppose $a_1=pk$ if $p|a_1 +a_2......a_j$ for some $j<p$ then $p$ divides any $p-j$ consecutive $a_i$ and so on since $gcd(p,j)=1$ we will have $p|a_j$ unless $a_2+pk=2s_2 ^2$ thus $2 \equiv \frac{a_2}{s_2 ^2} mod p$ since $a_2 $ is a perfect square $(\frac{2}{p})=1$ in general $(a_2+a_3....a_j)+pk=js_j ^2$ and since $a_2+a_3....a_j=(j-1)y^2 $ we will have $(\frac{\frac{j}{j+1}}{p})=1 \forall j<p-2$ but $\frac{j}{j+1}$ is surjective on $Z_p$ since if $\frac{a}{a+1} \equiv \frac{b}{b+1} mod p \implies a \equiv b mod p$ a contradiction now if $q^2|a_1$ then define $a'_i=\frac{a_i}{q^2}$ ($a'_i$ is still satisfying the condition) until we have $a_1=1$ and if there exist $j : a_j \neq 1$ contradiction from the claim thus $a_i=1 \forall i \in N$ and then thus $a_i=c^2 \forall i \in N$ and we win
24.03.2020 01:02
Solved with eisirrational, goodbear, Th3Numb3rThr33. Let $p$ be a prime dividing $a_1$. Note that for each $i$, \[a_i\equiv-(a_{i+1}+\cdots+a_{i+p-1})\equiv a_{i+p}\pmod p,\]so the sequence $(a_i)$ is periodic with period $p$ modulo $p$. Take the least quadratic nonresidue $k$. Claim: $p\mid a_2+\cdots+a_k$. Proof. Assume for contradiction otherwise. Then $(k-1)(a_2+\cdots+a_k)$ and $k(a_2+\cdots+a_k)$ are both quadratic residues modulo $p$ (the latter since $p\mid a_1$). Hence we have \begin{align*} 1&=\left(\frac kp\right)\left(\frac{a_2+\cdots+a_k}p\right)=-\left(\frac{a_2+\cdots+a_k}p\right)\\ 1&=\left(\frac{k-1}p\right)\left(\frac{a_2+\cdots+a_k}p\right)=\left(\frac{a_2+\cdots+a_k}p\right), \end{align*}contradiction. $\blacksquare$ Claim: $p\mid a_{k+1}$ Proof. Assume for contradiction otherwise. Then $k(a_2+\cdots+a_{k+1})\equiv ka_{k+1}$ is a quadratic residue modulo $p$. If $a_{k+1}\not\equiv0\pmod p$, then \[1=\left(\frac kp\right)\left(\frac{a_{k+1}}p\right)=-1\]since $a_{k+1}$ is a perfect square, contradiction. $\blacksquare$ Now apply the same argument with $a_1$ replaced by $a_{k+1}$; we have $p\mid a_{mk+1}$ for any $m$. However $\gcd(k,p)=1$ and $(a_i)$ has period $p$ modulo $p$, so all terms of $(a_i)$ are divisible by $p$; in fact they are divisible by $p^2$, since all terms of $(a_i)$ are perfect squares. Divide out $p^2$ and repeat the argument (not necessarily with $p\mid a_1$). Eventually all numbers equal $1$, so we are done.
14.04.2020 13:38
13.06.2020 02:53
Solved with hint from @v_Enhance: Assume we do not have $a_i=1$ for all $i.$ $\textbf{Lemma: }$ For a prime $p$ and $r,x\not\equiv 0\pmod{p},$ $$\left(\frac{r}{p}\right)=\left(\frac{x/r}{p}\right)\iff\left(\frac{x}{p}\right)=1.$$ $\textbf{Proof: }$ Just note that $$\left(\frac{x/r}{p}\right)=\left(\frac{xr}{p}\right)=\left(\frac{x}{p}\right)\left(\frac{r}{p}\right)\blacksquare$$ $\textbf{Claim :}$ If a prime $p$ divides $a_{k}$ for some positive integer $k,$ then it divides all terms of the sequence. $\textbf{Proof: }$ If $p=2,$ the claim is obvious, as the sum of every pair of consecutive terms must be even, so assume $p>2.$ Let $a$ be the smallest quadratic non-residue modulo $p.$ By the given information, we have $$\left(\frac{(a_k+a_{k+1}+\dots+a_{k+a-1})/a}{p}\right)=1,$$$$\left(\frac{(a_{k+1}+a_{k+2}+\dots+a_{k+a-1})/(a-1)}{p}\right)=1.$$But by the minimality of $a,$ we know $a$ is not a quadratic residue modulo $p$ and $a-1$ is, so $$\left(\frac{(a_k+a_{k+1}+\dots+a_{k+a-1})/a}{p}\right)\ne\left(\frac{a}{p}\right),$$$$\left(\frac{(a_{k+1}+a_{k+2}+\dots+a_{k+a-1})/(a-1)}{p}\right)=\left(\frac{a-1}{p}\right).$$By our lemma, if $a_k+a_{k+1}+\dots+a_{k+a-1}=a_{k+1}+a_{k+2}+\dots+a_{k+a-1}$ is nonzero modulo $p,$ then it must be both a QR and a QNR, which is impossible. Hence, we have $$a_{k}=a_{k+1}=\dots=a_{k+a-1}\equiv 0\pmod{p}.$$We can apply the same logic for any $k$ in any direction, so we have proved the claim. $\blacksquare$ The above result implies that all terms of the sequence must divide all members of a finite set of primes, say $\{p_{1},p_{2},\dots,p_{m}\}.$ Furthermore, since all of the terms are perfect squares, all of the terms must be divisible by $P=p_{1}^{2}p_{2}^{2}\dots p_{m}^{2}.$ But then, dividing all terms by $P$ yields another valid sequence, so we can apply the claim again. Eventually, this process must produce the sequence of all ones, so all terms of the original sequence must be equal.
14.11.2020 06:57
We show that if a prime $p$ divides some $a_i$, $p$ divides all $a_i$. This suffices because then we can divide out by $p^2$ for any prime $p$ dividing some $a_i$ until there exist no primes dividing any $a_i$ and the statement is trivially true. We first show this result for $p=2$; note that $p\mid a_i$ implies $p\mid a_{i-1}$ and $p\mid a_{i+1}$ by taking $k=2$. Now, take an odd prime $p$ dividing some $a_i$. First, we note that it suffices to show $p\mid a_j$ for all $j>i$; then, we must have $p\mid a_{i-1}$ because $a_{i-1}/k$ is a quadratic residue modulo $p$ for all $p\nmid k$, and we can similarly show $p\mid a_{i-2}$ and so on. Suppose that $p$ does not divide all $a_j$ with $j>i$ for contradiction, shift $i$ so that $p\nmid a_{i+1}$. Shift the indices so $i=1$. Now, pick $k\ne 0,1\pmod{p}$ for which $k$ is not a quadratic residue modulo $p$ and $k-1$ is. Note at least one such $k$ must exist because $1$ and $0$ are quadratic residues modulo $p$, and there exists at least one nonquadratic residue modulo $p$. For such $k$, observe that the information that $(a_1+\cdots+a_k)/k$, $(a_2+\cdots+a_k)/(k-1)$ are both quadratic residues modulo $p$ and $a_1\equiv0\pmod{p}$ implies that $a_1+\cdots+a_k\equiv a_2+\cdots+a_k\equiv 0\pmod{p}$. Then, observe that because $(a_2+\cdots+a_{k+1})/k\equiv a_{k+1}/k$ is a quadratic residue modulo $p$ and $a_{k+1}$ is a quadratic residue modulo $p$, we must have $p\mid a_{k+1}$. A similar argument implies in general that if $p\mid a_i$, then $p\mid a_{i+k}$ for all $i$. Since $k+p$ satisfies the same condition as $k$, we also have that $p\mid a_i\implies p\mid a_{i+k+p}\forall i$. By the Chicken McNugget Theorem on relatively prime $k+p,k$, we see that all sufficiently large $a_i$ are divisible by $p$, so we can use a similar argument to in our first reduction to show that $p$ divides all $a_i$, so we are done.
10.12.2020 20:01
$\textbf{Claim:}$ Every term in the sequence is a square. Well no crud sherlock. $\square$ The crux claim is the following: $\textbf{Claim:}$ If a prime $p$ divides some term of the sequence, it divides all. Define $x_{i, j}^2$ as the average of the terms starting from index $i$ and with length $j$. Assume that $p | a_1$, in other words $p^2 | a_1$. Now, notice that $$a_1 + a_2 + \cdots + a_p = p \cdot x_{1, p}^2,$$thus $$p \mid a_2 + \cdots + a_p.$$However, by analyzing the sequence from $a_2$ to $a_{p + 1}$ of length $p$, we realize that $p | a_{p + 1}$, or $p^2 | a_{p + 1}$. Thus we have the following: if $p^2 | a_i$, then $p^2 | a_{i + p}, a_{i - p}, a_{i + 2p}$, etc. Now, we do some algmanipping and we get the following two equations of interest, taking $p | a_n$: $$\begin{aligned} a_n + a_{n + 1} + \cdots a_{n + k - 1} &= k \cdot x_{n, k}^2 \\ a_{n + 1} + \cdots a_{n + k - 1} &= (k - 1) \cdot x_{n + 1, k - 1}^2. \end{aligned}$$Now, choose the smallest $k$ such that $\frac{k - 1}{k}$ is a QNR. Henceforth all QR or QNR are mod p. Observe that $0$ is a QR, $1$ is a QR, and then this selection forces all the numbers up to $k - 1$ to be QRs, and then $k$ is a QNR. As a result $a_{n + 1} + \cdots a_{n + k - 1}$ is a QR. Taking mod $p$, we find $$a_{n + 1} + \cdots + a_{n + k - 1} \equiv k \cdot x_{n,k}^2,$$which is a contradiction unless $p | a_{n + 1} + \cdots + a_{n + k - 1}$. Now look at $$k \cdot x_{n + 1, k}^2 = a_{n + 1} + \cdots + a_{n + k - 1} + a_{n + k} \equiv a_{n + k} \pmod p, $$but then this explodes since $a_{n + k}$ is a square and the left hand side is a QNR. Thus $p | a_{n + k}$. Now, we find that for $p | a_n$, any index that differs from $n$ by a linear combination of $k$ and $p$ is also divisible by $p$. Thus by Bezout or EuclidAlg we are done. $\square$ At this point, we're basically done. Take some prime $p$ that divides the sequence, divide out $p^2$. The remaining thing either has no $p$'s left, or it still has $p$. Keep dividing, and this finishes.
07.01.2021 08:22
math154 wrote: Let $a_1,a_2,a_3,\ldots$ be a sequence of integers, with the property that every consecutive group of $a_i$'s averages to a perfect square. More precisely, for every positive integers $n$ and $k$, the quantity \[\frac{a_n+a_{n+1}+\cdots+a_{n+k-1}}{k}\]is always the square of an integer. Prove that the sequence must be constant (all $a_i$ are equal to the same perfect square). Evan O'Dorney and Victor Wang Cool problem First, take $k = 1$, we deduce that every term is a square. Claim 01. $a_{i + k} \equiv a_i \ (\text{mod} \ k)$ for all positive integers $i$ and $k$. Proof. Just note that the condition of the problem gives us the "extra" condition that $k \mid a_i + a_{i + 1} + \dots + a_{i + k - 1}$. Therefore, we have \[ k \mid a_i + a_{i + 1} + \dots + a_{i + k - 1} \ \text{and} \ k \mid a_{i + 1} + a_{i + 2} + \dots + a_{i + k} \]Therefore, $k \mid a_{i + k} - a_i$. Since $\frac{a_i + a_{i + 1} + \dots + a_{i + k - 1}}{k}$ is a square for all $i,k \in \mathbb{N}$, we deduce that $k(a_i + a_{i + 1} + \dots + a_{i + k - 1})$ is also a square for all $i,k \in \mathbb{N}$. For convenience, let $b_{i,k}^2 = k(a_i + a_{i + 1} + \dots + a_{i + k - 1})^2$. Claim 02 (Main Claim). If $p \mid a_i$ for some $i \in \mathbb{N}$, then $p \mid a_k$ for all $k \in \mathbb{N}$. Proof. Shift any $a_i \mapsto a_1$. Now, take any prime $p$ dividing $a_1$ and let $j$ be the least quadratic non residue modulo $p$. This means that $j - 1$ is a quadratic residue. Therefore, \begin{align*} \left( \frac{j}{p} \right) \left( \frac{a_1 + \dots + a_{j}}{p} \right) &= \left( \frac{j(a_1 + \dots + a_{j})}{p} \right) \\ &= \left( \frac{b_{1,j}^2}{p} \right) \\ &= 1 \\ &= \left( \frac{ b_{2,j - 1}^2}{p} \right) \\ &= \left( \frac{(j - 1)(a_2 + \dots + a_j)}{p} \right)\\ &= \left( \frac{j - 1}{p} \right) \left( \frac{a_2 + \dots + a_j}{p} \right) \end{align*}This is enough to force $p \mid a_2 + \dots + a_j$. Since $a_{j + 1}$ is a square, we can have \begin{align*} \left( \frac{a_{j + 1}}{p} \right)&= 1 \\ &= \left( \frac{j(a_2 + \dots + a_{j + 1})}{p} \right) \\ &= \left( \frac{j}{p} \right) \left( \frac{a_{j + 1}}{p} \right) \end{align*}This is enough to force $p \mid a_{j + 1}$. Now, shift $a_{j + 1} \mapsto a_1$. We could apply the same exact argument to conclude that $p \mid a_{nj + 1}$ for all $n \in \mathbb{N}$. Since $j$ is a QNR modulo $p$, then $\gcd(j,p) = 1$. Therefore, $nj + 1$ is a complete residue modulo $p$. Now, by Claim 01, we have $a_{i + pk} \equiv a_i \ (\text{mod} \ p)$. This is enough to conclude that $p \mid a_n$ for all $n \in \mathbb{N}$. Now, since $p \mid a_i$ for all $i \in \mathbb{N}$ and all $a_i$s are squares, then $p^2 \mid a_i$ for all $i \in \mathbb{N}$. Transform $a_i \mapsto \frac{a_i}{p^2}$, and applying the same method. Take the smallest element $\min_{i \in \mathbb{N}} a_i = a_{\ell}$. Use this method to reduce $a_{\ell}$ to $1$. Suppose that there exists any other element that is not $1$, applying Claim 02 leads to a contradiction. Therefore, $a_i = 1$ for all $i \in \mathbb{N}$, forcing the sequence to be initially constant. Remark. Spoiled by the title of the handout "Quadratic Reciprocity" since I won't try using that in my first few guesses when trying this problem. The first few intuition when doing this problem is ELMO 2018 N3, deduce easily that $a_{i + k} \equiv a_i \ (\text{mod} \ k)$. The ingenious move is on Claim 02, which exploits the idea of Quadratic Residues. At first after deriving the second claim, I get something like $a_1 \mid a_2 \mid a_3 \mid \dots$ and don't know how to continue for half an hour. Then, I realize that we could use a similar approach to prove that the sequence must be constant once and for all.
20.01.2021 08:40
First, note that if $p \mid a_k$ for some $k$ then $p \mid a_k + \ldots + a_{k + p - 1}$ so $p \mid a_{k+1} + \ldots + a_{k+p-1}$ and also $p \mid a_{k+1} + \ldots + a_{k+p}$ hence $p \mid a_{k+p}$ thus $p \mid a_{k+p\ell}$ for all $\ell$. Now, let $i$ be the minimal index for which $a_i \neq 1$, where $p$ is some prime dividing $a_i$. Now choose a $m < p$ for which $m$ is the least NQR; clearly $m \geq 2$. Since\[m(a_i + \ldots + a_{i+m-1}) = m^2\left(\tfrac{a_i + \ldots + a_{i+m-1}}{m}\right)\]\[(m-1)(a_{i+1} + \ldots + a_{i+m-1}) = (m-1)^2\left(\tfrac{a_{i+1} + \ldots + a_{i+m-1}}{m-1}\right)\]both are squares, they are both QRs mod $p$ and thus\[\left(\frac{m(a_i + \ldots + a_{i+m-1})}{p}\right) = \left(\frac{(m-1)(a_{i+1} + \ldots + a_{i+m-1})}{p}\right) = 1.\]Assume $p \nmid a_i + \ldots + a_{i+m-1}$. Since $m$ is a NQR, then $a_i + \ldots + a_{i+m-1}$ therefore must be a NQR, and so must $a_{i+1} + \ldots + a_{i+m-1}$, hence $m-1$ is a NQR which is not possible since we assumed $m$ is minimal. Thus, $a_i + \ldots + a_{i+m-1}$ must be $0$ mod $p$. Note that $m(a_{i+1} + \ldots + a_{i+m}) \equiv ma_{i+m} \pmod p$ where the former is equal to $m^2\left(\tfrac{a_{i+1} + \ldots + a_{i+m}}{m}\right)$ is a QR hence\[\left(\frac{ma_{i+m}}{p}\right) = 1\]so either $a_{i+m}$ is a NQR or it is divisible by $p$, where the former is impossible since all terms are perfect squares. Thus $p\nmid a_{i+m}$, and we may repeat this argument to get $p \mid a_{i+m\ell}$ for all $\ell$. Note that upon combining this with $p \mid a_{i + p\ell}$ for all $\ell$, since $m, p$ are relatively prime, we may hit all indices $j$ covering all residues modulo $p$ so that $p \mid a_j$, hence we may shift up or down by $p$ to get that all terms are divisible by $p$ and thus also $p^2$. Repeat the above process to the new sequence defined by $b_n = \tfrac {a_n}{p^2}$, which satisfies the condition that all consecutive terms average to a perfect square. This way, eventually after enough repeats, we must get to a point where we have divided out all possible primes and no prime $p$ divides any term, and we would be done. $\blacksquare$
06.09.2021 08:26
Claim #1: $a_X$ is a perfect square for all $X$ Proof: Take $k=1$ and we wil be done. Claim #2: If a prime $p$ divides any one term of the sequence it must divide all the terms. Proof: The case $p=2$ is trival. Assume that $p>2$ and for the sake of contradiction assume not. Denote $a$ to be the smallest quadratic non residue $\pmod p$ and by the condition $a-1$ is a quadratic residue $\pmod p$ Notice that this implies $\left(\frac{a(a_i + \ldots + a_{i+m-1})}{p}\right) = \left(\frac{(a-1)(a_{i+1} + \ldots + a_{i+m-1})}{p}\right) = 1 \implies \left(\frac{a}{p}\right) \equiv \left(\frac{(a-1)}{p}\right)$, contradiction so this is true. By Claim 1 and 2 we get the sequence $a_F$ is constant and is a perfect square,so we are done.$\blacksquare$
24.01.2022 07:09
Nice. Solved with rama1728. Take any prime $p.$ Suppose $p \mid a_j$ for any $a_j.$ Verify $a_i \equiv -(a_{i+1}+ \dots + a_{i+p-1}) \equiv a_{i+p} \pmod{p}$ for all $i.$ Take the minimal QNR $r \pmod{p}.$ Note $r(a_j+a_{j+1}+ \dots + a_{j+r-1})$ is a QR, so $a_j+\dots + a_{j+r-1} \equiv a_{j+1} + \dots + a_{j+r-1}$ is a QNR or $0.$ Since $(r-1)(a_{j+1} + \dots + a_{j+r-1})$ is a QR, we have $a_{j+1}+ \dots + a_{j+r-1}$ is a QR so it is $0.$ Also, $r(a_{j+1}+ \dots + a_{j+r-1}+a_{j+r}) \equiv ra_{j+r}$ is a QR. So $a_{j+r}$ is a QNR or $0.$ Since $a_{j+r}$ is a QR (take $k=1$ in the given) it is $0.$ Repeating this argument shows if $a_j \equiv 0 \pmod{p}$ then $a_{j+mr} \equiv 0 \pmod{p}$ or any positive integer $m.$ Since $\gcd(r,p) = 1$ we can see all $a_i$ are divisible by $p,$ and thus by $p^2$ as well. So divide all terms by $p^2.$ Then verify that for any $n,$ \[\frac{a_n+a_{n+1}+\cdots+a_{n+p-1}}{p}\]will still be an integer (and thus a square) after this transformation, since we knew $$\frac{p^2a_n+p^2a_{n+1}+\cdots+p^2a_{n+p-1}}{p} = p(a_n+a_{n+1}+\cdots+a_{n+p-1})$$was a square, implying $p \mid (a_n+a_{n+1}+\cdots+a_{n+p-1}).$ It's trivial to verify \[\frac{a_n+a_{n+1}+\cdots+a_{n+r-1}}{r}\]will also still be an integer (and thus a square) after this transformation since $\gcd(r,p) = 1.$ So we can keep repeating this argument until $p$ doesn't divide any term of the sequence anymore. Repeating this for all possible $p$ brings all terms of the sequence to $1$ as desired. $\blacksquare$
05.06.2022 23:45
Consider any prime $p$; I claim that either every term in the sequence divides $p$ or none does. We can divide out $p^2$ in the former case to induct. First, by setting $k=p$ note that every $k$ consecutive terms sum up to a multiple of $p$, hence $a_n\equiv a_{n+p}\pmod{p}$ for all $n$. If $p=2$ the claim is obvious; assume otherwise. Suppose that $a_c\equiv 0\pmod{p}$. If $a_{c+1}$ is a multiple of $p$, then we can get $a_{c+k}$ as a multiple of $p$ for all $1\le k\le p-1$ by shifting, hence every term is a multiple of $p$ as desired. Otherwise, for all $1\le k<p-1$ we have $\frac{a_c+a_{c+1}+\ldots +a_{c+k}}{k+1}\equiv \frac{a_{c+1}+\ldots +a_{c+k}}{k+1},\frac{a_{c+1}+\ldots +a_{c+k}}{k}$ are both QR's mod $p$. If $\frac{k+1}{k}$ is not a QR, then we would need $a_{c+1}+\ldots +a_{c+k}$ to be a multiple of $p$. Since $a_{c+1}$ is not a multiple of $p$, $2$ must be a QR mod $p$, and hence $\frac{p-1}{p-2}\equiv \frac{1}{2}$ is as well. Among the remaining $p-4$ values of $k$, for at most $\frac{p-1}{2}-3$ of them would $\frac{k+1}{k}$ be a QR (accounting for the fact that $\frac{k+1}{k}\nequiv 1\pmod{p}$ too), so there must be a specific value $3\le d\le p-3$ such that neither of $\frac{d+1}{d},\frac{d}{d-1}$ are QRs mod $p$. This necessitates that $a_{c+d}$ is a multiple of $p$, hence we can shift the sequence to get that $a_{c+2d},a_{c+3d}\ldots a_{c+(p-1)d}$ are multiples of $p$ as well, which finishes the problem since they are surjective mod $p$.
23.04.2023 18:07
Claim. $a_i \equiv a_j \pmod p$ when $i \equiv j \pmod p$. Proof. As the averages must always be integers, we always have $a_i \equiv a_{i+p} \pmod p$. Now assume that a prime $p$ divides some term of the sequence. I claim that $p$ divides every term of the sequence. Extend the sequence arbitrarily in both directions, and WLOG $p \mid a_0$. Let $S_k= a_1+a_2+\cdots+a_{k-1}$ for each $k$. The condition implies $$\left(\frac{S/k}p\right) = 1 \text{ and } \left(\frac{S/(k-1)}p\right) = 1$$for all $k$. On the other hand, this is satisfied if and only if $\left(\frac kp\right) = \left(\frac{k-1}p\right)$ or $p \mid S$. The former condition holds if and only if $\frac k{k-1}$ is a QR, so there are at least $\frac{p+1}2$ sums $S_k$ for $0 \leq k \leq p-1$ (including $S_0 = a_0$) that are all multiples of $p$. But by Pigeonhole, two of those sums must be consecutive, so $p \mid a_m$ for some $p \nmid m$. Now, repeating this argument yields $p \mid a_{qm}$ for any $q$. It follows by the claim that every term of the sequence is a multiple of $p$, as needed.
06.02.2024 09:00
my guess is to observe $a_i \equiv a_{i+j}\pmod j$ and then consider residues mod prime, with some care I proved that $a_i$ is constant mod $3$ for all $a_i$'s. Now we need to generalize this for all primes somehow, which doesn't seem hard
13.02.2024 10:47
Let $p$ be a prime divisor of $a_1$. Note that the sequence $(a_n)_{n\ge 1}$ has a period $p$, so whenever $i \equiv j (p)$, we have $a_i \equiv a_j$. Let $q$ be the least non-quadratic residue. Then consider the following claim: Claim: $p \mid a_1 + a_2 + \dots + a_q$ and $p \mid a_{q+1}$. Proof. If $p \nmid a_1 + a_2 + \dots + a_q$, then we get $1 = \left(\frac{q(a_1 + a_2 + \dots + a_q)}{p}\right) = \left(\frac{q(a_2 + a_3 + \dots + a_q)}{p}\right) = \left(\frac{q(q-1)}{p}\right)$. Since $q$ is the least non-quadratic residue, so $\left(\frac{q-1}{p}\right) = 1$ and $\left(\frac{q}{p}\right) = -1$, hence $\left(\frac{q(q-1)}{p}\right) = -1$, a contradiction. Thus $p \mid a_1 + a_2 + \dots + a_q$. Now assume $p \nmid a_{q+1}$. Then we have $1 = \left(\frac{(q+1)(a_1 + a_2 + \dots + a_{q+1})}{p}\right) = \left(\frac{(q+1)(a_{q+1})}{p}\right) = \left(\frac{q+1}{p}\right)$, hence $\left(\frac{q+1}{p}\right) = 1$. On the other hand, we have $1 = \left(\frac{(q+1)(a_1 + a_2 + \dots + a_{q+1})}{p}\right) = \left(\frac{(q+1)(a_2 + a_3 + \dots + a_{q+1})}{p}\right) = \left(\frac{(q+1)q}{p}\right) = \left(\frac{q}{p}\right) = 1$, contradicting the fact that $q$ is the least non-quadratic residue. $\blacksquare$ By claim, we get $p \mid a_{q+1}$ and replacing $a_1$ to $a_{q+1}$, we get $p \mid a_{2q+1}$. Repeating the same argument, we get $p \mid a_{qk+1}$ for all $k$. But the sequence $(a_n)_{n \ge 1}$ has modulo $p$, so for all $i$, there exists $k$ such that $qk + 1 \equiv i (p)$, hence $0 \equiv a_{qk+1} \equiv a_i(p)$, which means $p \mid a_i$ for all $i$. Thus replacing $a_i \to \frac{a_i}{p^2}$, the sequence $(a_n)_{n \ge 1}$ eventually becomes $(1, 1, 1, \dots)$. Hence we're done. $\blacksquare$
07.04.2024 15:42
We show that for any prime $p$, $v_p(a_i)$ is constant, which will imply the required result. Claim: For any prime $p$, if $p\mid a_m$ for some $m$, then $p\mid a_i$ for every positive integer $i$. Proof. Let $k$ be an integer such that $p\nmid k$ and that $1-\frac1k$ is not a quadratic residue $\pmod{p}$. Let $S$ be the set of all such $k\pmod{p}$. Then, $|S|=\frac{p-1}2$ as there are those many non-quadratic residues, and every element of $S$ is from $[2, p-1]$ because $p\mid 0$ and $(1-1)$ are quadratic residue $\pmod{p}$. So, we are choosing from $p-2$ elements, and hence by pigeonhole principle there are two numbers in $S$ with difference at most (exactly) 1. Let that number be $t,t+1$. Suppose $p\mid a_l$. We claim that $p\mid a_{l+t}$. Suppose $k\in S$ is a random element from $S$. Consider the averages: \[\frac{a_l+a_{l+1}+\cdots+a_{l+k-1}}{k}, \ \ \ \frac{a_{l+1}+\cdots+a_{l+k-1}}{k-1}\]Note that both of them are quadratic residues $\pmod{p}$. Suppose they are both not divisible by $p$. Then, we can divide them in $\pmod p$ to get that $\frac {k-1}k=1-\frac1k$ is a quadratic residue $\pmod{p}$, which is a contradiction as $k\in S$. So, our assumption that the averages above are not divisible by $p$ are incorrect. Hence, $p\mid a_l+a_{l+1}+\cdots+a_{l+k-1}$ for any $k\in S$. We also know that $t,t+1\in S$, which means $p\mid a_l+a_{l+1}+\cdots+a_{l+t-1}$ and $p\mid a_l+a_{l+1}+\cdots+a_{l+t}$. Subtracting, we get that $p\mid a_{l+t}$. Hence, the entire sequence of $a_m, a_{m+t}, a_{m+2t}, \ldots$ has each term divisible by $p$. Since $p\nmid t$, the set $\{m, m+t, \ldots, m+(p-1)t\}$ is the complete residue class $\pmod{p}$. Finally, note that for any positive integer $i$, each of the sums $a_i+a_{i+1}+\cdots+a_{i+p-1}$ and $a_{i+1}+\cdots+a_{i+p}$ are divisible by $p$. So, $a_i\equiv a_{i+p}\equiv a_{i+2p}\equiv\cdots \pmod{p}$. In general, if $i\equiv j\pmod{p}$, then $a_i\equiv a_j\pmod{p}$. Since $\{m, m+t, \ldots, m+(p-1)t\}$ is the complete residue class $\pmod{p}$, we have that all $a_i$ are divisible by $p$, as required. $\blacksquare$ We know that each term in $a_1,a_2,\ldots$ is a perfect square, so if all terms are divisible by a prime $p$, then all are divisible by $p^2$. Let $2v=\min\{v_p(a_1),v_p(a_2),\ldots\}$. Clearly, $v$ is finite and positive. Let $v_p(a_u)=2v$. Consider the sequence $\frac{a_1}{p^{2v}}, \frac{a_2}{p^{2v}}, \ldots$, it clearly satisfies the required condition. Moreover, all terms are integers, and since $p\nmid \frac{a_u}{p^{2v}}$, it means $p$ does not divide any term. So, for any $n\geq1$, we have $v_p(a_n)=2v$. Since this holds for any prime, we are done. $\blacksquare$
08.04.2024 16:43
Suppose there was some nonconstant working sequence. For each prime $p>2$, let $f(p)$ be the smallest quadratic non residue modulo $p$ (in particular $1 < f(p) < p$). Claim: For any prime $p$, if $p\mid a_k$, then $p\mid a_{k+f(p)}$, where $f(p)$ is the smallest quadratic nonresidue modulo $p$ and additionally $a_{k + 1} + a_{k+2}+\cdots + a_{k + f(p) - 1}\equiv 0\pmod p$. Proof: Suppose otherwise for some $p$ and $a_k$. Let $m = f(p)$ and $S = a_{k+1} + a_{k+2} + \cdots + a_{k + (m-1)}$. Since $\frac{S}{m-1}$ is a perfect square and $m-1$ is a QR modulo $p$, $S$ must also be a QR modulo $p$. Note that $\frac{S + a_k}{m}$ is a perfect square, so it must be a QR modulo $p$. However, $m$ isn't a QR modulo $p$, meaning that either $S + a_k \equiv 0\pmod p$, or $S + a_k$ is an NQR modulo $p$. However, $a_k \equiv 0\pmod p$, so $S + a_k$ must be a QR modulo $p$, implying that $S \equiv 0\pmod p$. Now, $\frac{S + a_{k + m}}{m}$ must also be a perfect square. However, in modulo $p$, this implies that $\frac{a_{k+m}}{m}$ is a QR modulo $p$. Since $a_{k+m}$ is a QR modulo $p$ and $m$ isn't, $a_{k+m} \equiv 0\pmod p$ must hold. $\square$ Claim: For any odd prime $p$, if $p$ divides $a_k$ (and $k > 1$), then $p$ divides $a_{k-1}$. Proof: Suppose otherwise for some $p$ and $k$. Again let $m = f(p)$. We have $a_k , a_{k+m}, a_{k + 2m}, \ldots, $ are all $0\pmod p$, so $a_{k + n \cdot m}\equiv 0\pmod p$ for any nonnegative integer $n$. Now define $b_n = a_{k + (n-1) m} + a_{k + (n-1) m + 1} + \cdots + a_{k + nm - 1}$ for any positive integer $n$. Since $a_{k + (n-1) m }\equiv 0\pmod p$, we must have $b_n\equiv 0\pmod p$. Now notice that $\sum_{i=k - 1}^{k + x\cdot m - 1} a_i = a_{k - 1} + b_1 + b_2 + \cdots + b_{x-1} \equiv a_{k - 1} \pmod p $ for any nonnegative integer $x$. However, this must be a perfect square times $x\cdot m + 1$, so $\frac{a_{k-1}}{x\cdot m + 1}$ is a QR modulo $p$. Now if $a_{k - 1} \not \equiv 0\pmod p$, we may choose $x\cdot m + 1$ to be a quadratic non residue modulo $p$ (since $m$ is relatively prime to $p$), so $\frac{a_{k-1}}{x\cdot m + 1}$ won't be a QR mod $p$, absurd. $\square$ Claim: For any odd prime $p$, if $p\mid a_k$ for some $k$, then $p$ divides all $a_i$. Proof: By the above claim, it suffices to prove that $p$ divides $a_i$ for sufficiently large $i$. This is evident from the fact that $p\mid a_{k + f(p)}, a_{k + 2f(p)}, \ldots, a_{k + n f(p)}$ for any nonnegative integer $n$. $\square$ Consider repeating this process: If $p$ divides all $a_i$ for some prime $p$, divide all $a_i$ by $p^2$. This yields an integer sequence satisfying the problem conditions since $p\mid a_i$ implies $p^2 \mid a_i$ as all the $a_i$ are perfect squares. Now repeat this process until impossible. We end up with a nonconstant working sequence $(a_i)$ where no prime divides every element of the sequence. By the earlier claim, no odd prime can divide any element of the sequence, implying the sequence only consists of powers of $2$. Now consider some consecutive $a,b$ (in some order) in the sequence with $\nu_2(a) \ne \nu_2(b)$ (must exist since the sequence isn't constant). WLOG that $\nu_2(a) < \nu_2(b)$. Clearly $\nu_2(a)$ and $\nu_2(b)$ are even. Now $\frac{a+b}{2}$ must be a perfect square. But, $\nu_2(a+b) = \nu_2(a)$ is even, so $\frac{a+b}{2}$ has an odd $\nu_2$, and thus can't be a perfect square, absurd. Hence the sequence must be constant.
16.08.2024 23:12
Excellent problem, it's nice to post something other than geo sometimes lol, afterall MO is also full of other beautiful things as well . By the condition note that if $b \equiv c \pmod{\ell}$ then $a_b \equiv a_c \pmod{\ell}$ and that by taking $k=1$ we get that all $a_i$'s are perfect squares so now if $2 \mid a_j$ for some $j$, by the condition we also get $2 \mid a_{j+1}$ so we in fact get (by square thing) $4 \mid a_{\ell}$ for all $\ell \in \mathbb Z_{>0}$, then we can make the map $a_i \to \frac{a_i}{4}$ and make a new sequence, and repeat until stuck so now wlog all $a_i$'s are odd. Suppose FTSOC that the sequence was not constant, take some minimal $j$ s.t. for some odd prime $p$ we have $p \mid a_j$ (which exists otherwise all terms are $1$), now consider $\alpha$ to be the minimal positive integer $2 \le \alpha \le p-1$ such that $\alpha$ is NQR $\pmod p$. Now note that we have: $$\left(\frac{\alpha(a_{j+1}+\cdots+a_{j+\alpha-1})}{p} \right)=\left(\frac{(\alpha-1)(a_{j+1}+\cdots+a_{j+\alpha-1})}{p} \right)=1 \; \text{or} \; 0$$If they were equal to $1$ we have that $a_{j+1}+\cdots+a_{j+\alpha-1}$ is QR but also a NQR $\pmod p$ since $\alpha-1$ is a QR, contradiction!. Therefore they are both $0$ and thus $p \mid a_{j+1}+\cdots+a_{j+\alpha-1}$ now consider: $$\left(\frac{\alpha(a_{j+1}+\cdots+a_{j+\alpha})}{p} \right)=\left(\frac{\alpha \cdot a_{j+\alpha}}{p} \right)=1 \; \text{or} \; 0$$If they were equal to $1$ we would have $a_{j+\alpha}$ NQR $\pmod p$ but that can't happen since it's a perfect square so they must be $0$ therefore $p \mid a_{j+\alpha}$, now since $\gcd(\alpha,p)=1$ we can repeat this and cover all residues $\pmod p$ so we get $p^2 \mid a_{\ell}$ for all $\ell \in \mathbb Z_{>0}$, then by mapping $a_i \to \frac{a_i}{p^2}$ we can just WLOG $\gcd(a_i,p)=1$ for all $i \in \mathbb Z_{>0}$ but we will eventually do this with all posible prime divisors of $a_i$ (counted with multiplicity) so they will eventually all banish to $a_i=1$ for all $i \in \mathbb Z_{>0}$ contradiction to the non-constantness. Therefore $a_i=\beta^2$ for some $\beta$ for all $i \in \mathbb Z_{>0}$ thus we are done .
20.08.2024 02:47
Our main claim is that one prime $p$ dividing a term of the sequence implies $p$ divides all terms of the sequence. Notice this finishes, as we divide all terms by $p^2$ to get a new sequence which must satisfy the condition, from which we induct down to 1. The case $p=2$ can be completed just with parity in blocks of 2. Otherwise, considering odd $p$, the consecutive blocks $(i, \ldots, p+i-1)$ and $(i+1, \ldots, p+i)$ tells us \[p \mid (a_i + \ldots + a_{p+i-1}) - (a_{i+1} + \ldots + a_{p+i}) = a_i - a_{p+i} \implies a_i \equiv a_{p+i},\] so it only suffices to consider indices modulo $p$. If all terms are 1, we are done. Otherwise, suppose WLOG $p \mid a_0$. Taking $k \not\equiv -1,0 \pmod p$, we notice \[\frac{a_1 + \ldots + a_k}{k}, \quad \frac{a_0 + \ldots + a_k}{k+1} \equiv \frac{a_1 + \ldots + a_k}{k+1}\] are both quadratic residues modulo $p$. Call a value of $k$ valid if $\{k, k+1\} = \{\text{QR}, \text{NQR}\}$ and neither are 0 modulo $p$, this can't hold unless $p \mid a_1 + \ldots a_k$. From here, it suffices to find a suitable $j$ such that $j$ and $j+1$ are both valid. We'd be done as then $p \mid a_{j+1}$, from which we inductively get $p \mid a_{i(j+1)}$ for all $i$, and $0, (j+1), \ldots, (p-1)(j+1)$ forms a complete residue class modulo $p$ covering the entire sequence. Notice that if 2 is a NQR we get $p \mid a_1$, giving the desired. Otherwise, it suffices to find a suitable $j$ with $\frac{k-1}{k} = 1-k^{-1}$ as a NQR. But then we have $\frac{p-1}{2}$ valid values of $j$, corresponding to each NQR, which must be in the range $[3,p-1]$, from which Pigeonhole gives consecutive values. $\blacksquare$