Let us read a number k from right to left and call the result RVR(k); e.g. RVR(1)=1 , RVR(45)=54 , RVR(1200000000)=21.
1.Find the smallest positive integer k for which RVR(k) > (k^2 mod 100000).
2. Find the sum of the 10000 RVRs i.e. for all integers from 1 to 10000 inclusive.
Based upon problems from projectkhayyam.blogspot.com
(In reply to
Q-1 ? by ed bottemiller)
For part 1, the computer solution is really overkill, as the number is the very first whose square is above 100000.
My part 2 answer differs from ed bottemiller's:
list
10 for K=1 to 10000
20 Ks=cutspc(str(K))
30 Kr=0
40 for I=len(Ks) to 1 step -1
50 Kr=10*Kr+val(mid(Ks,I,1))
60 next I
70 if Kr>(K^2)@100000 then if Flag=0 then print K,Kr:endif:Flag=1
75 Sum=Sum+Kr
80 next K
90 ?sum
run
317 713
45454546
this last number, 45,454,546, being the answer for part 2.
|
Posted by Charlie
on 2010-11-18 22:09:55 |