cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

2, 11, 81, 611, 4798, 39320, 333583, 2897573, 25632474, 230231687, 2091437006, 19145032382, 176258021378, 1630867803755, 15161044498785, 141573907590908, 1327916557473475, 12513166293358138, 118472791400037286, 1126683083504083356, 10754171449735292485
Offset: 1

Views

Author

Reiner Moewald, Jul 30 2019

Keywords

Comments

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

Examples

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

Crossrefs

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

Programs

  • Mathematica
    f[n_] := Length[NestWhileList[# - Total[IntegerDigits[#]]&, n, # > 0 &]]-1; f /@ (10^Range[8]) (* Amiram Eldar, Aug 08 2019 *)
  • PARI
    a(n)={my(s=10^n, k=0); while(s, k++; s-=sumdigits(s)); k} \\ Andrew Howroyd, Sep 09 2019
  • 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))
    

Extensions

a(13)-a(15) from Giovanni Resta, Sep 10 2019
a(16) and on from Dominic McCarty, Feb 12 2025