Consider a product
P=8*(888...888), i.e.
8 times a number represented by a chain of
k eights.
For what value of k the sum of P's digits is exactly 1000?
k P s.o.d.
1 64 10
2 704 11
3 7104 12
4 71104 13
5 711104 14
6 7111104 15
7 71111104 16
8 711111104 17
9 7111111104 18
10 71111111104 19
11 711111111104 20
12 7111111111104 21
13 71111111111104 22
14 711111111111104 23
15 7111111111111104 24
16 71111111111111104 25
17 711111111111111104 26
18 7111111111111111104 27
19 71111111111111111104 28
20 711111111111111111104 29
The sum of digits is 9 higher than k.
For sod=1000, use k=991.
3 kill "pieceof8.txt"
4 open "pieceof8.txt" for output as #2
5 Rhf=8:P=8*Rhf:print 1,P,10:print #2,1,P,10
10 for K=2 to 20
20 Rhf=10*Rhf+8
30 Sod=0
40 S=cutspc(str(8*Rhf))
50 for I=1 to len(S)
60 Sod=Sod+val(mid(S,I,1))
70 next
80 print K,8*Rhf,Sod
81 print #2,K,8*Rhf,Sod
100 next K
110 close #2
|
Posted by Charlie
on 2015-07-15 10:46:46 |