login
A309417
Number of steps needed to reduce 10^n to zero by subtracting its digital sum.
0
2, 11, 81, 611, 4798, 39320, 333583, 2897573, 25632474, 230231687, 2091437006, 19145032382, 176258021378, 1630867803755, 15161044498785
OFFSET
1,1
COMMENTS
Conjecture: lim_{n->infinity} a(n+1)/a(n) = 10.
EXAMPLE
a(100)=11 since 100->99->81->72->63->54->45->36->27->18->9->0.
MATHEMATICA
f[n_] := Length[NestWhileList[# - Total[IntegerDigits[#]]&, n, # > 0 &]]-1; f /@ (10^Range[8]) (* Amiram Eldar, Aug 08 2019 *)
PROG
(Python)
import math
def digitsum(n):
ds = 0
while n > 0:
ds += n % 10
n = n // 10
return ds
def steps(n):
count = 0
while n > 0:
n = n - digitsum(n)
count += 1
return count
n = 1
for i in range(1, 10):
n = 10 * n
print(steps(n))
(PARI) a(n)={my(s=10^n, k=0); while(s, k++; s-=sumdigits(s)); k} \\ Andrew Howroyd, Sep 09 2019
CROSSREFS
Cf. A066568 (n - sum of digits of n).
Sequence in context: A277500 A197718 A359222 * A215654 A330677 A209094
KEYWORD
nonn,base,more
AUTHOR
Reiner Moewald, Jul 30 2019
EXTENSIONS
a(13)-a(15) from Giovanni Resta, Sep 10 2019
STATUS
approved