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.

A358620 Number of nonzero digits needed to write all nonnegative n-digit integers.

Original entry on oeis.org

9, 171, 2520, 33300, 414000, 4950000, 57600000, 657000000, 7380000000, 81900000000, 900000000000, 9810000000000, 106200000000000, 1143000000000000, 12240000000000000, 130500000000000000, 1386000000000000000, 14670000000000000000, 154800000000000000000
Offset: 1

Views

Author

Bernard Schott, Nov 23 2022

Keywords

Examples

			a(1) = 9 because there are 9 one-digit numbers that are > 0.
a(2) = 171 because there are 90 two-digit numbers, so 90*2 = 180 digits are needed to write these integers, nine of these integers end with 0, and 180-9 = 171.
		

Crossrefs

Programs

  • Maple
    seq((9*(9*n+1))*10^(n-2), n = 1 .. 20);
  • Mathematica
    a[n_] := 9*(9*n + 1)*10^(n - 2); Array[a, 20] (* Amiram Eldar, Nov 23 2022 *)
  • PARI
    a(n)=(81*n+9)*10^(n-2) \\ Charles R Greathouse IV, Nov 29 2022
    
  • Python
    def A358620(n): return 9 if n == 1 else 9*(9*n+1)*10**(n-2) # Chai Wah Wu, Nov 29 2022

Formula

a(n) = 9 * (9*n+1) * 10^(n-2).
a(n) = 20*a(n-1) - 100*a(n-2); a(1)=9, a(2)=171.
a(n) = 9 * A081045(n-1).
a(n) = A113119(n) - A212704(n-1), for n >= 2.