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
KEYWORD
nonn,base,more
AUTHOR
Reiner Moewald, Jul 30 2019
EXTENSIONS
a(13)-a(15) from Giovanni Resta, Sep 10 2019
STATUS
approved