Determine all possible positive base ten
repdigit(s) N, such that the sum of the digits of N
2 is equal to 37.
list
10 for Rd=1 to 9
20 N=Rd
30 loop
40 N2=N*N:N2s=cutspc(str(N2))
45 T=0
50 for I=1 to len(N2s)
60 T=T+val(mid(N2s,I,1))
70 next
80 if T=37 then print N,N2
90 N=10*N+Rd
100 if N>99999999999999999999 then goto 120
110 endloop
120 next
200 end
OK
run
2222 4937284
7777 60481729
OK
Since n^2 can't have more than 37 digits, n can't have more than 19, so the list is complete at (2222, 7777).
|
Posted by Charlie
on 2009-06-04 13:27:18 |