A perfect square is represented by BCCDEFGGB, where each of the letters is denoted by a distinct nonzero digit.
Furthermore:
- Each of BCCD and EFGGB is a perfect square.
- Each of EF and GGB is a perfect square.
Determine the square root of the number represented by BCCDEFGGB.
Note: Computer program solutions are welcome but a semi-analytic (calculator+p&p) method is preferred.
The requested square root is: 24035
The unique solution is:
577681225 5776 81225 81 225
-------------
sq2 = [i**2 for i in range(4,10)]
sq3 = [i**2 for i in range(10,32)]
sq4 = [i**2 for i in range(32,100)]
sq5 = [i**2 for i in range(100,317)]
sq9 = [i**2 for i in range(10000,31623)]
firstSols = []
for i in sq4:
for j in sq5:
x = int(str(i)+str(j))
if x not in sq9:
continue
firstSols.append(x)
strx = str(x)
ef = int(strx[4:6])
ggb = int(strx[6:9])
if ef in sq2 and ggb in sq3:
print(x, i, j, ef, ggb)
bccd = [i for i in sq4 if str(i)[1] == str(i)[2]]
ggbPossibles = []
for i in range(32,1000):
stri3 = str(i**2)[-3:]
if stri3[0] == stri3[1] and stri3[0] != stri3[2] :
if int(stri3) not in ggbPossibles:
ggbPossibles.append(int(stri3))
------- Of some interest --------
There are 16 solutions to the subproblem satisfying just the first condition, considering only BCCD and EFGGB:
102414400
129618225
152127556
160022500
193627225
230432400
270438025
313644100
360050625
409657600
462465025
518472900
577681225
592922500
640090000
705699225
The only possible values for GGB that perfect squares can end in:
[1, 4, 9, 116, 224, 225, 336, 441, 449, 556, 664, 776, 881, 884, 889, 996] (G=0 for the single digit numbers)
|
Posted by Larry
on 2023-04-10 14:40:57 |