For a natural number $N$, consider all distinct perfect squares that can be obtained from $N$ by deleting one digit from its decimal representation. Prove that the number of such squares is bounded by some value that doesn't depend on $N$.
Problem
Source: All-Russian 2022 11.7=10.8
Tags: number theory
25.04.2022 22:51
10.06.2023 19:14
Very nice problem. If I use $k/2$ and $k$ is odd I really mean $\lfloor k/2 \rfloor$. First suppose that $N$ has some odd number of trailing zeroes. Then there is at most one square obtained by deleting a digit, since if the digit we delete is not a trailing zero, then the resulting number has an odd number of trailing zeroes and is not a square. On the other hand, if there is an even number of trailing zeroes, deleting a trailing zero yields a number with an odd number of trailing numbers that is therefore not a square, so only deleting non-trailing zeroes can ever yield a square and we can simply delete all the trailing zeroes and induct down. Therefore, assume that $N$ does not have trailing zeroes. Suppose we have $d>1000$ digits in $N$ and the number formed by deleting the $i$-th digit from the left is $a_i$. If we pick $i$ minimal such that $a_i$ is a square, then for size reasons the next square must differ from it by at least $10^{d-5}$, hence the second-smallest $i$ with $a_i$ square is at least $\tfrac{d}{2}-10$. We now prove the following claim, which is the key insight into the problem. Claim: The last $k>100$ digits of a square not divisible by $10$ determine its square root modulo either $2^{k-10}5^{k/2-10}$ or $2^{k/2-10}5^{k-10}$ down to at most four values. Proof: Suppose that $2 \nmid x$ be our square root and suppose $x+2y$ has the same last $k$ digits, so $$(x+2y)^2-x^2 \equiv 0 \pmod{10^k} \implies 4xy+4y^2 \equiv 0 \pmod{10^k} \implies y(x+y) \equiv 0 \pmod{2^{k-2}5^k}.$$Exactly one of $y$ and $x+y$ will be even, which then means that term must actually be divisible by $2^{k-2}$, so we obtain $y \in \{0,-x\} \pmod{2^{k-2}}$, giving two values for $y \pmod{2^{k-10}}$. Furthermore, if $5^k \mid y(x+y)$, then either $y \equiv 0 \pmod{5^{k/2-10}}$ or $x+y \equiv 0 \pmod{5^{k/2-10}}$ (possibly both), so we have at most two values for $y \pmod{5^{k/2-10}}$, which yields at most four values for $y \pmod{2^{k-10}5^{k/2-10}}$. If $5 \nmid x$, the claim is similarly true. $\blacksquare$ Now, consider some value of $i$ such that $a_i$ is a square. We then have $\cdots \equiv a_{i+2} \equiv a_{i+1} \equiv a_i \pmod{10^{i-10}}$, so if $j>i$ has $a_j$ square then by the claim $\sqrt{a_j}$ must be one of two fixed values (depending on $a_i$ and the modulus) modulo $2^{i-20}5^{i/2-30}$ or $5^{i/2-30}2^{i-0}$. If we take $j$ to be the second-smallest possible value (still keeping the constraint $j>i$) it can be, then we have $\sqrt{a_j}-\sqrt{a_i} \geq 2^{i-20}5^{i/2-30}$. Since $\sqrt{a_i} \geq 10^{d/2-5}$, we have $$a_j-a_i \geq (10^{d/2-5}+2^{i-20}5^{i/2-30})^2-(10^{d/2-5})^2=2^{i-19}5^{i/2-30}\cdot 10^{d/2-5}+2^{2i-40}\geq 10^{d/2+7i/12-30},$$where $\tfrac{7}{12}$ comes from the fact that $\log_10(2) \geq \tfrac{1}{4}$ and $\log_10(5) \geq \tfrac{2}{3}$, hence $2^{i}5^{i/2} \geq 10^{7i/12}$. Then, since the second-smallest $i$ with $a_i$ square is at least $\tfrac{d}{2}-10$, the above consideration means the sixth-smallest $i$ with $a_i$ square is at least $\tfrac{d}{2}-10+\tfrac{7}{12}(\tfrac{d}{2}-10)\geq \tfrac{19d}{24}-16$. Then applying the above again, the tenth-smallest $i$ with $a_i$ square is at least $\tfrac{d}{2}-10+\tfrac{7}{12}(\tfrac{19d}{24}-16)=\tfrac{277}{288}-20$. Then applying the above again, the fourteenth-smallest $i$ with $a_i$ is at least $\tfrac{d}{2}-10+\tfrac{7}{12}(\tfrac{277}{288}-20)\geq \tfrac{3667d}{3456}-22$, but this is greater than $d$, which is absurd. Therefore there are finitely many $i$ such that $a_i$ is a square, so we are done. $\blacksquare$ Remark: The explicit calculation is totally unnecessary since we just need $\tfrac{7}{12}>\tfrac{1}{2}$, but I included it here because I didn't feel like worrying about constant factors and because it's somewhat surprising that the bound on the number of squares obtainable is not only finite but actually $13$ (at least when $d>1000$).