16 is the smallest 2-digit square whose digits are non-decreasing.
144 is the smallest 3-digit square whose digits are non-decreasing.
1156 is the smallest 4-digit square whose digits are non-decreasing.
GO ON!
The squares and their square roots:
16 4
144 12
1156 34
11236 106
111556 334
2666689 1633
11115556 3334
277788889 16667
1111155556 33334
11122233444 105462
111111555556 333334
2777778888889 1666667
11111115555556 3333334
277777788888889 16666667
1111111155555556 33333334
27777777888888889 166666667
111111111555555556 333333334
2777777778888888889 1666666667
11111111115555555556 3333333334
(stopped as the rest take "forever")
5 open "howfargo.txt" for output as #2
10 Base=11
20 loop
30 Sr=-int(-sqrt(Base))
40 Good=0
50 while Good=0
60 Sq=Sr*Sr
70 S$=cutspc(str(Sq))
75 Good=1
80 for I=2 to len(S$)
90 if mid(S$,I,1)<mid(S$,I-1,1) then Good=0:cancel for:goto 120
100 next
120 if Good=0 then inc Sr
130 wend
140 print Sq,Sr:print #2,Sq,Sr
150 Base=Base*10+1
160 endloop
|
Posted by Charlie
on 2015-05-12 10:26:36 |