# Squares Ending in 5 Occurrences of 2-Digit Pattern

## Theorem

Let $n$ be a square number whose decimal representation ends in the pattern $\mathtt {xyxyxyxyxy}$.

Then $\mathtt {xy}$ is one of:

$21, 29, 61, 69, 84$

The smallest examples of such numbers are:

 $\ds 508 \, 853 \, 989^2$ $=$ $\ds \phantom {0 \,} 258 \, 932 \, 38 \mathbf {2 \, 121 \, 212 \, 121}$ $\ds 162 \, 459 \, 327^2$ $=$ $\ds \phantom {0 \, 0} 26 \, 393 \, 03 \mathbf {2 \, 929 \, 292 \, 929}$ $\ds 1 \, 318 \, 820 \, 881^2$ $=$ $\ds 1 \, 739 \, 288 \, 51 \mathbf {6 \, 161 \, 616 \, 161}$ $\ds 541 \, 713 \, 187^2$ $=$ $\ds \phantom {0 \,} 293 \, 453 \, 17 \mathbf {6 \, 969 \, 696 \, 969}$ $\ds 509 \, 895 \, 478^2$ $=$ $\ds \phantom {0 \,} 259 \, 993 \, 39 \mathbf {8 \, 484 \, 848 \, 484}$

## Proof

### Case $1$: $\mathtt {xy}$ is odd

Consider the last $3$ digits of $n$: $\mathtt {yxy}$.

$n \equiv \mathtt {yxy} \equiv 1 \pmod 8$
$n \equiv \mathtt {yxy} \equiv 0, 1, 4 \pmod 5$

We have:

 $\ds \mathtt {yxy}$ $\equiv$ $\ds 25, 1, 9$ $\ds \pmod {40}$ Chinese Remainder Theorem $\ds$ $\equiv$ $\ds 1, 9, 25, 41, 49, 65, 81, 89, 105, 121, 129, 145, 161, 169, 185$ $\ds \pmod {200}$

Since $y$ is odd, we have $\mathtt {yxy} \equiv 1 \mathtt {xy} \pmod {200}$.

Hence $\mathtt {xy}$ can only be $05, 21, 29, 45, 61, 69, 85$.

Suppose $n$ ends in $5$ in decimal representation.

By Divisibility by 5, $5 \divides n$.

Since $5$ is a prime, $5 \divides \sqrt n$.

$n \equiv 25 \pmod {200}$

for which none of $\mathtt {xy} = 05, 45, 85$ satisfy.

This shows that $\mathtt {xy}$ can only be $21, 29, 61, 69$.

$\Box$

### Case $2$: $\mathtt {xy}$ is even

Consider the last $2$ digits of $n$: $\mathtt {xy}$.

We omit the trivial case $\mathtt {xy} = 00$.

This case occurs whenever $10 \divides \sqrt n$.

Since $\sqrt n$ is even:

$n \equiv \mathtt {xy} \equiv 0 \pmod 4$

Since $5 \nmid \sqrt n$, by Square Modulo 5:

$n \equiv \mathtt {xy} \equiv 1, 4 \pmod 5$

We have:

 $\ds \mathtt {xy}$ $\equiv$ $\ds 16, 4$ $\ds \pmod {20}$ Chinese Remainder Theorem $\ds$ $\equiv$ $\ds 4, 16, 24, 36, 44, 56, 64, 76, 84, 96$ $\ds \pmod {100}$

In the list above:

$4, 24, 36, 44, 56, 76, 84$ are divisible by $2^2$ but not $2^4$
$16, 96$ are divisible by $2^4$ but not $2^6$
$64$ is divisible by $2^6$

Write $n = 10^{10} k + 101010101 \times \mathtt {xy}$.

We require $\dfrac n {2^{2 d}}$ to be a square number as well, where $d$ is the largest integer where $2^{2d} \divides \mathtt {xy}$ (shown above).

We have:

 $\ds \frac n {2^{2 d} }$ $=$ $\ds 5^{10} \times 2^{10 - 2 d} \times k + 101010101 \times \frac {\mathtt {xy} } {2^{2 d} }$ $\ds$ $\equiv$ $\ds \frac {5 \paren {\mathtt {xy} } } {2^{2 d} }$ $\ds \pmod 8$ as $10 - 2 d > 3$ $\ds$ $\equiv$ $\ds 0, 1, 4$ $\ds \pmod 8$ Square Modulo 8

and:

$\mathtt {xy} = 04, 16, 24, 36, 44, 56, 64, 76, 84, 96$

corresponds to:

 $\ds \frac {3 \paren {\mathtt {xy} } } {2^{2 d} }$ $=$ $\ds 5, 5, 30, 45, 55, 70, 5, 85, 105, 30$ $\ds$ $\equiv$ $\ds 5, 5, 6, 5, 7, 6, 5, 5, 1, 6$ $\ds \pmod 8$

Thus the only valid $\mathtt {xy}$ is $84$.

$\Box$

We have considered all possibilities, and the only possible $\mathtt {xy}$ are:

$21, 29, 61, 69, 84$

and by the examples shown, all these numbers do indeed produce squares.

$\blacksquare$

## Historical Note

According to David Wells in his $1997$ book Curious and Interesting Numbers, 2nd ed., this result is attributed to J.A.H. Hunter, in volume $6$ of the Journal of Recreational Mathematics.

No online corroboration of this can be found online, as there appears to be no consolidated archive of this magazine.

The author of this page would give his right arm to have a copy of the entire series resting on a bookshelf in his study.