login
A367244
a(n) is the number of n-digit numbers whose difference between the largest and smallest digits is equal to 3.
7
0, 13, 119, 733, 3815, 18133, 81599, 354493, 1504055, 6278053, 25904879, 106011853, 431253095, 1746686773, 7051884959, 28403182813, 114200118935, 458563556293, 1839545301839, 7374058107373, 29543870469575, 118318410678613, 473702458475519, 1896096339905533, 7588244995073015
OFFSET
1,2
COMMENTS
a(n) is the number of n-digit numbers in A366960.
FORMULA
a(n) = 27*4^(n-1) - 41*3^(n-1) + 7*2^n.
a(n) = 9*a(n-1) - 26*a(n-2) + 24*a(n-3) for n > 3.
O.g.f.: x^2*(13 + 2*x)/((1 - 2*x)*(1 - 3*x)*(1 - 4*x)).
E.g.f.: (exp(x) - 1)^2*(81*exp(2*x) - 2*exp(x) - 1)/12.
MATHEMATICA
LinearRecurrence[{9, -26, 24}, {0, 13, 119}, 25]
KEYWORD
nonn,base,easy
AUTHOR
Stefano Spezia, Nov 11 2023
STATUS
approved