Determine the smallest positive perfect cube whose base ten representation begins and ends with 888.
The required cube is 88831160947109888
If a perfect cube starts and ends with 888, then:
its cube roots start with [207, 446, 961]
its cube roots end with [192, 442, 692, 942]
This narrows down the searching considerably.
I wrote 2 programs, the first just concatenating prefixes and suffixes and the second dealing with additional digits in between. It turns out the second program was not needed to find the smallest such cube.
The first program yielded:
446192 88831160947109888
961192 888035735381989888
961442 888728833166762888
----------
for pre in [207, 446, 961]:
for suff in [192, 442, 692, 942]:
x = int(str(pre) + str(suff))
cube= x**3
if cube % 1000 != 888:
continue
if int(str(cube)[:3]) != 888:
continue
print(x,cube)
Further results:
2070942 8881857638766336888
2071192 8885074627659109888
2071442 8888292393248882888
4461442 88802614886488762888
4461692 88817544071564285888
4461942 88832474929774308888
9611942 888041833070348108888
4462192 88847407461212581888
4462442 88862341665972854888
4462692 88877277544148877888
4462942 88892215095834400888
9612192 888111126944361381888
9612442 888180424422946654888
---------- second program ----------
for i in range(100):
for pre in [207, 446, 961]:
for suff in [192, 442, 692, 942]:
x = int(str(pre) + str(i) + str(suff))
cube= x**3
if cube % 1000 != 888:
continue
if int(str(cube)[:3]) != 888:
continue
print(x,cube)
|
Posted by Larry
on 2022-08-02 07:29:55 |