Each letter represents a digit from 0 to 9. No number can contain any leading zero.
Find a perfect square of the form ABCDEF such that all these conditions are simultaneously satisfied:
•ABC is a perfect square.
•BCD is a perfect square.
•DEF is a perfect square.
225625 is the square of 475
225 is the square of 15
256 is the square of 16
625 is the square of 25
--------------
squares = [s**2 for s in range(0,1000)]
for n in range(317,1000):
s = n**2
sts = str(s)
ABC = int(sts[:3])
if ABC not in squares:
continue
BCD = int(sts[1:4])
if BCD not in squares:
continue
DEF = int(sts[3:6])
if DEF not in squares:
continue
print(s)
|
Posted by Larry
on 2024-08-20 18:39:47 |