login
A358620
Number of nonzero digits needed to write all nonnegative n-digit integers.
1
9, 171, 2520, 33300, 414000, 4950000, 57600000, 657000000, 7380000000, 81900000000, 900000000000, 9810000000000, 106200000000000, 1143000000000000, 12240000000000000, 130500000000000000, 1386000000000000000, 14670000000000000000, 154800000000000000000
OFFSET
1,1
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.
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Bernard Schott, Nov 23 2022
STATUS
approved