# Find a six-digit perfect square of a particular form – BMO 1993 P1

1993 British Mathematical Olympiad, Round 1, Question 1

Find, showing your method, a six-digit integer $n$ with the following properties:

1. $n$ is a perfect square,
2. the number formed by the last three digits of $n$ is exactly one greater than the number formed by the first three digits of $n$. (Thus $n$ might look like $123124$, although this is not a square.)

I gave it a try, albeit number theory not being a strong suit of mine. $$\text{n = }\overline{ABCABD}\text{, where } D = C +1$$ $$n = 10^5\times A + 10^4\times B + 10^3\times C + 10^2\times A + 10^1\times B + 10^0\times D \\=A(10^5+10^2) + B(10^4+10) + C(10^3+10^0)+1\qquad\qquad\,$$ $$\\n-1 = (10^3+1)\times(10^2\times A+10^1\times B + 10^0 \times C)\\\frac{n-1}{1001} = \overline{ABC}$$ $\text{The question then becomes:}\\\text{Find } r\in\mathbb{Z^+}\,(r = \overline{ABC})\text{ such that }$ $$n = 1001r + 1\\10^5\le n\le 10^6-1,\,n\in\mathbb{Z^+}$$ This, however, appears to have gotten me nowhere as I have no idea how to solve that linear equation.

SIDE NOTE: Using Python, I found that $r\in\{{183,328,528,715}\}$. Therefore, $n\in\{{183184,328329,528529,715716}\}$.

However, I would like to see a mathematical solution.

Hint The condition $n = 1001 r + 1$ does not express one of our conditions, namely that $n$ is a square, say, $m^2$ for some positive integer $m$. In terms of $m$, our condition is $m^2 = 1001 r + 1$, and the key observation is that this equation can be rearranged and then factored: $$(m + 1) (m - 1) = 1001 r .$$ Now, both sides are factorizations of the same integer. The prime factorization of $1001$ is $1001 = 7 \cdot 11 \cdot 13$, so one or two of these three primes are factors of $m + 1$ and the other(s) are factors of $m - 1$. (If all three were factors of the same term, we would have $m \pm 1 = 1001$, and in both cases here $m^2$ has seven digits.)
If we take the case that $7, 11$ are factors of $m + 1$ and $13$ is a factor of $m - 1$, then we have$$\left\{\begin{array}{rcl}m + 1 &=& 7 \cdot 11 s \\m - 1 &=& 13 t\end{array}\right.$$ for some integers $m, s, t$; $r$ is just $r = s t$. Eliminating $m$ gives $$77 s = 13 t + 2$$ for some $s, t$, and reducing modulo $13$ and solving gives $s \equiv 11 \pmod {13}$, so the smallest positive solution is $s = 11$; substituting gives that the the corresponding value is $t = 65$, so $r = st = 715$ (reproducing one of the given answers) and hence $n = 715716$. The next smallest positive solution is $s = 24$, but this corresponds to a four-digit $m$, and hence to an $m^2$ of at least seven digits, so $r = 715$ is the only solution from this case. Proceeding similarly for the other five cases should yield the other three solutions.