144 is a perfect square. When the first and last digit are interchanged, we obtain a different perfect square, 441.
Likewise, there exist two distinct perfect squares of four digits, which differ only in the interchange of the first and last digits. Give the greatest of these two perfect squares.
Note : There are only 68 four-digit perfect squares, so this problem can be solved fairly easily by writing them all out. However, can you find a way that reduces the amount of work to be done?
For the five-digit version, see this problem .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let the two squares be N 2 > M 2 . Since they have four digits, it is clear that 9 9 ≥ N > M ≥ 3 2 .
If a > d > 0 are the first and last digits of N 2 , then we have N 2 − M 2 = ( 1 0 0 0 a − d ) − ( 1 0 0 0 d − a ) = 9 9 9 ( a − d ) . Define h = a − d ; we have ( N + M ) ( N − M ) = 9 9 9 h , 1 ≤ h ≤ 8 . We know that { N − M ≤ 9 9 − 3 2 = 6 7 6 4 ≤ N + M ≤ 1 9 8 Moreover, the prime factor decomposition 9 9 9 = 3 3 ⋅ 3 7 . This means that either N + M or N − M is a multiple of 37. This greatly reduces the number of situations we must consider. The above equations are necessary conditions for finding the solution, but not sufficient . We must therefore carefully check each solution to see if it really works.
Case 1 . If N + M is a multiple of 37, then it is at least 2 × 3 7 = 7 4 and at most 5 × 3 7 = 1 8 5 .
In the special situation N + M = 1 1 1 = 3 × 3 7 , N − M = 3 2 h is a multiple of 9. Since N + M and N − M are of equal parity, h must be odd; we have the possibilities
h = 1 , N − M = 9 , N = ( 1 1 1 + 9 ) / 2 = 6 0 , M = ( 1 1 1 − 9 ) / 2 = 5 1 ; this is not a solution because N 2 may not end in zero.
h = 3 , N − M = 2 7 , N = ( 1 1 1 + 2 7 ) / 2 = 6 9 , M = ( 1 1 1 − 2 7 ) / 2 = 4 2 . This is the solution we look for: 6 9 2 = 4 7 6 1 , 4 2 2 = 1 7 6 4 .
Otherwise, N − M is a multiple of 3 3 = 2 7 , i.e. equal to either 2 7 or 5 4 . Again, N + M and N − M must have equal parity. Thus
N + M = 2 ⋅ 3 7 = 7 4 , N − M = 5 4 , N = 6 4 , M = 1 0 . This would make M 2 end in zero, which is not possible.
N + M = 4 ⋅ 3 7 = 1 4 8 , N − M = 5 4 , N = 1 0 1 is too large.
N + M = 5 ⋅ 3 7 = 1 8 5 , N − M = 2 7 , N = 1 0 6 is too large.
Case 2 . If N − M is a multiple of 37, then it must be equal to 37, and N + M = 2 7 h . Equal parity requires that h is odd. Thus
N − M = 3 7 , N + M = 3 × 2 7 = 8 1 , N = 5 9 , M = 2 2 . But this would give M 2 only three digits.
N − M = 3 7 , N + M = 5 × 2 7 = 1 3 5 , N = 8 6 , M = 4 9 . However, then M 2 would end in 1 and N 2 is clearly greater than 2000. This is not a solution.
N − M = 3 7 , N + M = 7 × 2 7 = 1 8 9 , N = 1 1 3 is too large.
Conclusion : We found only one solution, the pair 6 9 2 = 4 7 6 1 , 4 2 2 = 1 7 6 4 .