cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A109002 Maximal difference between two n-digit numbers.

Original entry on oeis.org

9, 89, 899, 8999, 89999, 899999, 8999999, 89999999, 899999999, 8999999999, 89999999999, 899999999999, 8999999999999, 89999999999999, 899999999999999, 8999999999999999, 89999999999999999, 899999999999999999, 8999999999999999999, 89999999999999999999, 899999999999999999999
Offset: 1

Views

Author

Amarnath Murthy, Aug 14 2005

Keywords

Examples

			a(1) = 9 - 0 = 9, a(4) = 9999 - 1000 = 8999.
		

Crossrefs

Programs

  • Magma
    [9] cat [9*10^n-1: n in [1..30]]; // Vincenzo Librandi, Oct 29 2011
    
  • 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 *)
  • PARI
    a(n)=if(n>1,(10^n-1)-10^(n-1),9) \\ Charles R Greathouse IV, Oct 29 2011

Formula

a(n) = (10^n - 1) - 10^(n-1), n > 1.
From Reinhard Zumkeller, May 28 2010: (Start)
a(n) = A061601(A178500(n-1)).
a(n+1) = 10*a(n) + 9. (End)
G.f.: 9*x - x^2*(-89+80*x)/((10*x-1)*(x-1)). - R. J. Mathar, Oct 29 2011
From Elmo R. Oliveira, Jun 12 2025: (Start)
E.g.f.: (1 + 10*x - 10*exp(x) - exp(10*x) + 10*exp(10*x))/10.
a(n) = 11*a(n-1) - 10*a(n-2) for n >= 4. (End)