OFFSET
1,1
LINKS
Colin Barker, Table of n, a(n) for n = 1..950
The Math Forum, Ask Dr. Math: Really Counting to One Billion, 2001.
Index entries for linear recurrences with constant coefficients, signature (20,-100).
FORMULA
For n > 1, a(n) = 9*n*10^(n-1).
From Colin Barker, Aug 05 2016: (Start)
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)
From Bernard Schott, Nov 14 2022: (Start)
a(n) = A212704(n) for n > 1.
a(n) = 9 * A053541(n) for n > 1.
a(n) = 9 * A081045(n-1) + A212704(n-1), for n > 1 (means a(n) = number of nonzero digits + number of zero digits). (End)
E.g.f.: x*(1 + 9*exp(10*x)). - Stefano Spezia, Dec 24 2022
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)
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Nov 14 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Alexandre Wajnberg, Jan 03 2006
EXTENSIONS
More terms from Joshua Zucker, May 08 2006
a(17) corrected by Colin Barker, Aug 05 2016
STATUS
approved