This can be solved in a similar fashion as
"Spirit of '76 with no products". As an algorithm:
Set K=5^N
Set L=K
Set I=1
while I isn't greater than N
if the I-th digit from the right of K is 0, 1, 8
add L to K
add 1 to I
multiply L by 10
the answer is the N rightmost digits of K
|
Posted by e.g.
on 2004-08-30 08:35:32 |