Determine the smallest positive perfect cube whose first three digits (reading from the left) are 201 (in this order) and the last digit is 5.
The program takes the ceiling of the cube root of 201 followed by P zeros, and finds any solutions (cubes with the appropriate characteristics) that have the same number of digits as that number. Due to the way the cube roots are formed, if any exist with that number of digits, they will come first, before larger numbers.
3 kill "smalcube.txt"
5 open "smalcube.txt" for output as #2
10 for P=1 to 999
20 N=201*10^P
30 Cr=-int(-(N^(1/3)))
40 Dv5=-int(-Cr/5)
50 if Dv5@2=0 then Dv5=Dv5+1
55 loop
60 Cr=5*Dv5
70 N=Cr*Cr*Cr
80 Ns=cutspc(str(N))
90 if left(Ns,3)="201" and right(Ns,1)="5" then print N
91 if left(Ns,3)="201" and right(Ns,1)="5" then print #2,N:inc Ct:if Ct>12 then end
92 if left(Ns,3)>"201" then goto 100
93 Dv5=Dv5+2
95 endloop
100 next
finds these numbers that begin with 201 and are the smallest perfect cubes of their length and also end with 5. The first is 201745589625.
201745589625
2012306640625
2017092147875
20112552439875
20134747640125
20156959163375
20179187015625
201075567351625
201178550994875
201281569795125
201384623758375
201487712890625
201590837197875
|
Posted by Charlie
on 2015-07-15 16:03:18 |