OFFSET
2,1
COMMENTS
Let k(n) be the largest n-digit number, 10^n - 1, and let m(n) be the product of its digits, 9^n; then a(n) = (k(n) - m(n))/9.
LINKS
Matthew House, Table of n, a(n) for n = 2..996
Index entries for linear recurrences with constant coefficients, signature (20,-109,90).
FORMULA
G.f.: 2*x^2*(1-5*x)/((1-x)*(1-9*x)*(1-10*x)).
a(n) = 20*a(n-1) - 109*a(n-2) + 90*a(n-3). - Matthew House, Jan 16 2017
EXAMPLE
a(4) = (9999 - 9*9*9*9)/9 = 382.
MATHEMATICA
LinearRecurrence[{20, -109, 90}, {2, 30, 382}, 20] (* Harvey P. Dale, Oct 12 2017 *)
PROG
(PARI) for (n=2, 30, print1(((10^n -1) - 9^n)/9, ", "))
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), May 01 2003
EXTENSIONS
More terms from Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 15 2004
Edited by Jon E. Schoenfield, Jan 16 2017
STATUS
approved