 # 81 arithmetic/digits/squares/twin.p

## Description

This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.

# 81 arithmetic/digits/squares/twin.p

Let a twin be a number formed by writing the same number twice,
for instance, 81708170 or 132132. What is the smallest square twin?

arithmetic/digits/squares/twin.s

1322314049613223140496 = 36363636364 ^ 2.

The key to solving this puzzle is looking at the basic form of these
"twin" numbers, which is some number k = 1 + 10^n multiplied by some number
10^(n-1) <= a < 10^n. If ak is a perfect square, k must have some
repeated factor, since a<k. Searching the possible values of k for one
with a repeated factor eventually turns up the number 1 + 10^11 = 11^2
* 826446281. So, we set a=826446281 and ak = 9090909091^2 =
82644628100826446281, but this needs leading zeros to fit the pattern.
So, we multiply by a suitable small square (in this case 16) to get the
above answer.

Continue to: