This question is inspired by Google's recent programming competition (modified slightly for ease of exposition).
For a given $n$, one of the problems was to find all positive "fair" integers $k$ less than $n$, where $k$ is "fair" if
- $k$ is a palindrome (in base 10, no leading zeros)
- $k^2$ is also a palindrome.
One first result is that if $k$ is a palindrome, then $k^2$ will involve no carrying if and only if the sum of $k$'s squared digits is less than ten. Therefore all palindromes $k$ with sum of squared digits less than ten are "fair."
But can there be sporadic "fair" numbers? Palindromes $k$ where computing $k^2$ involves some carrying, but by pure chance $k^2$ still ends up being a palindrome?
Best Answer
I've tried solving the same problem yesterday. I managed to brute-force my way to finding all fair and square (palindromes whose square root is a palindrome) numbers from 1 to $10^{14}$:
My solution was correct, and the second dataset was solved. But I couldn't find a proper way to calculate all fair and square numbers up to $10^{100}$.
I showed this to my wife this morning, and she noticed an interesting pattern of numbers within my list:
Some fair and square numbers re-appear with space padding. Let's try beyond $10^{14}$. Adding some zeros to $1020302030406040302030201$, whose square root is $1010100010101$ - a palindrome!
Wish I had my wife with me when I solved this yesterday.
I don't have a mathematical explanation for this phenomena, but I guess that for some reason, every fair and square number beyond a certain boundary can be built by adding zeros to a smaller palindrome.