Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #27 Jan 23 2025 17:42:54
%S 9,89,899,8999,89999,899999,8999999,89999999,899999999,8999999999,
%T 89999999999,899999999999,8999999999999,89999999999999,
%U 899999999999999,8999999999999999,89999999999999999,899999999999999999,8999999999999999999,89999999999999999999,899999999999999999999
%N Maximal difference between two n-digit numbers.
%C a(n) = A061601(A178500(n-1)). - _Reinhard Zumkeller_, May 28 2010
%H Vincenzo Librandi, <a href="/A109002/b109002.txt">Table of n, a(n) for n = 1..200</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (11,-10).
%F a(n) = (10^n -1) - 10^(n-1), n > 1.
%F a(n+1) = 10*a(n) + 9. - _Reinhard Zumkeller_, May 28 2010
%F G.f.: 9*x - x^2*(-89+80*x) / ( (10*x-1)*(x-1) ). - _R. J. Mathar_, Oct 29 2011
%e a(1) = 9 - 0 = 9, a(4) = 9999 - 1000 = 8999.
%t 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 *)
%o (Magma) [9] cat [9*10^n-1: n in [1..30]]; // _Vincenzo Librandi_, Oct 29 2011
%o (PARI) a(n)=if(n>1,(10^n-1)-10^(n-1),9) \\ _Charles R Greathouse IV_, Oct 29 2011
%K base,easy,nonn,changed
%O 1,1
%A _Amarnath Murthy_, Aug 14 2005