login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A109002
Maximal difference between two n-digit numbers.
6
9, 89, 899, 8999, 89999, 899999, 8999999, 89999999, 899999999, 8999999999, 89999999999, 899999999999, 8999999999999, 89999999999999, 899999999999999
OFFSET
1,1
COMMENTS
a(n) = A061601(A178500(n-1)). - Reinhard Zumkeller, May 28 2010
FORMULA
a(n) = (10^n -1) - 10^(n-1), n > 1.
a(n+1) = 10*a(n) + 9. - Reinhard Zumkeller, May 28 2010
G.f.: 9*x - x^2*(-89+80*x) / ( (10*x-1)*(x-1) ). - R. J. Mathar, Oct 29 2011
EXAMPLE
a(1) = 9 - 0 = 9, a(4) = 9999 - 1000 = 8999.
MATHEMATICA
Join[{9}, Table[FromDigits[PadRight[{8}, n, 9]], {n, 2, 20}]] (* or *) LinearRecurrence[{11, -10}, {9, 89, 899}, 20] (* Harvey P. Dale, May 09 2021 *)
PROG
(Magma) [9], [9*10^n-1: n in [1..30]]; // Vincenzo Librandi, Oct 29 2011
(PARI) a(n)=if(n>1, (10^n-1)-10^(n-1), 9) \\ Charles R Greathouse IV, Oct 29 2011
CROSSREFS
Sequence in context: A138288 A370179 A059482 * A142991 A152267 A082147
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy, Aug 14 2005
STATUS
approved