A number AABCBC is the square of an integer. Find all possible values of AABCBC.
The possible values are:
{228484, 332929, 776161}
---------
def isSquare(n):
""" Input an integer, Returns True iff it is a perfect square. """
if round(n**0.5)**2 == n:
return True
else:
return False
for a in range(1,10):
for b in range(10):
for c in range(10):
x = a * 110000 + b * 1010 + c * 101
if isSquare(x):
print(x, (x**.5))
Output:
228484 478.0
332929 577.0
776161 881.0
It turns out, for this pattern, the only solutions have A, B, and C distinct
Edited on November 26, 2022, 6:49 am
|
Posted by Larry
on 2022-11-26 06:48:55 |