login
A367245
a(n) is the number of n-digit numbers whose difference between the largest and smallest digits is equal to 4.
7
0, 11, 135, 1103, 7551, 46871, 273735, 1534943, 8366031, 44674151, 234982935, 1222071983, 6301114911, 32274971831, 164471580135, 834802180223, 4223960206191, 21320114811911, 107403378865335, 540232762595663, 2714041233191871, 13621757688226391, 68315120054438535
OFFSET
1,2
COMMENTS
a(n) is the number of n-digit numbers in A366961.
FORMULA
a(n) = 29*5^(n-1) - 47*4^(n-1) + 2*3^(n+1).
a(n) = 12*a(n-1) - 47*a(n-2) + 60*a(n-3) for n > 3.
O.g.f.: x^2*(11 + 3*x)/((1 - 3*x)*(1 - 4*x)*(1 - 5*x)).
E.g.f.: (116*exp(5*x) - 235*exp(4*x) + 120*exp(3*x) - 1)/20.
MATHEMATICA
LinearRecurrence[{12, -47, 60}, {0, 11, 135}, 23]
KEYWORD
nonn,base,easy
AUTHOR
Stefano Spezia, Nov 11 2023
STATUS
approved