|
|
A113119
|
|
Total number of digits in all n-digit nonnegative integers.
|
|
5
|
|
|
10, 180, 2700, 36000, 450000, 5400000, 63000000, 720000000, 8100000000, 90000000000, 990000000000, 10800000000000, 117000000000000, 1260000000000000, 13500000000000000, 144000000000000000, 1530000000000000000, 16200000000000000000, 171000000000000000000
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
For n > 1, a(n) = 9*n*10^(n-1).
a(n) = 20*a(n-1) - 100*a(n-2) for n > 3.
G.f.: 10*x*(1 - 2*x + 10*x^2) / (1-10*x)^2.
(End)
a(n) = 9 * A081045(n-1) + A212704(n-1), for n > 1 (means a(n) = number of nonzero digits + number of zero digits). (End)
|
|
EXAMPLE
|
a(1)=10 because there are ten one-digit numbers (including the 0).
a(2)=180 because there are 100-10=90 two-digit numbers, for a total of 90*2=180 digits.
|
|
MATHEMATICA
|
LinearRecurrence[{20, -100}, {10, 180, 2700}, 20] (* Harvey P. Dale, Dec 09 2021 *)
|
|
PROG
|
(PARI) Vec(10*x*(1-2*x+10*x^2)/(1-10*x)^2 + O(x^20)) \\ Colin Barker, Aug 05 2016
(Python)
def a(n): return 10 if n == 1 else 9*n*10**(n-1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|