login
Number of n-digit numbers where every digit is either a 9 or adjacent to a 9.
0

%I #20 Nov 20 2024 09:46:52

%S 1,18,99,342,2691,13788,65709,407772,2115981,11108358,63181719,

%T 334551402,1802963871,9931645728,53256984129,288681869232,

%U 1572458030361,8484410567898,46019764248939,249748559819262,1351163694059451,7326501636596868,39716608228492149,215099382176679492

%N Number of n-digit numbers where every digit is either a 9 or adjacent to a 9.

%C The 9 in the definition can also be any other nonzero digit.

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,9,81).

%F G.f.: x*(1 + 8*x)*(1 + 9*x)/(1 - x - 9*x^2 - 81*x^3). - _Andrew Howroyd_, Oct 20 2024

%e The a(1) = 1 number is 9.

%e The a(2) = 18 numbers are 19, 29, 39, 49, 59, 69, 79, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99.

%o (PARI) Vec((1 + 8*x)*(1 + 9*x)/(1 - x - 9*x^2 - 81*x^3) + O(x^25)) \\ _Andrew Howroyd_, Oct 20 2024

%K nonn,base,easy

%O 1,2

%A _Edwin McCravy_, Oct 19 2024

%E a(9) onwards from _Andrew Howroyd_, Oct 20 2024