Devise an efficient method of finding consecutive squares which have the same digits.
Find such pairs up to 1000000.
Feel free to go further.
Well, if n^2 and (n+1)^2 have the same digits, then they have they same value mod 9, and their difference = 0 mod 9.
Their difference = 2n+1, so n = 4 mod 9.
So we only need to investigate every 9th n between 1 and 1000, starting with 4, for a possible 111 values. Not very efficient, so I want to see what somebody else comes up with.
Using Excel on these 111 values, the only ones I notice are:
n n^2 (n+1)^2
-- ------ ---------
13 169 196
157 24649 24964
913 833569 835396
This was based on manual inspection, so I might have missed some.