login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of steps needed to reduce 10^n to zero by subtracting its digital sum.
0

%I #28 Sep 23 2019 14:14:15

%S 2,11,81,611,4798,39320,333583,2897573,25632474,230231687,2091437006,

%T 19145032382,176258021378,1630867803755,15161044498785

%N Number of steps needed to reduce 10^n to zero by subtracting its digital sum.

%C Conjecture: lim_{n->infinity} a(n+1)/a(n) = 10.

%e a(100)=11 since 100->99->81->72->63->54->45->36->27->18->9->0.

%t f[n_] := Length[NestWhileList[# - Total[IntegerDigits[#]]&, n, # > 0 &]]-1; f /@ (10^Range[8]) (* _Amiram Eldar_, Aug 08 2019 *)

%o (Python)

%o import math

%o def digitsum(n):

%o ds = 0

%o while n > 0:

%o ds += n % 10

%o n = n // 10

%o return ds

%o def steps(n):

%o count = 0

%o while n > 0:

%o n = n - digitsum(n)

%o count += 1

%o return count

%o n = 1

%o for i in range(1,10):

%o n = 10 * n

%o print(steps(n))

%o (PARI) a(n)={my(s=10^n, k=0); while(s, k++; s-=sumdigits(s)); k} \\ _Andrew Howroyd_, Sep 09 2019

%Y Cf. A066568 (n - sum of digits of n).

%K nonn,base,more

%O 1,1

%A _Reiner Moewald_, Jul 30 2019

%E a(13)-a(15) from _Giovanni Resta_, Sep 10 2019