login
A367248
a(n) is the number of n-digit numbers whose difference between the largest and smallest digits is equal to 7.
7
0, 5, 111, 1601, 19095, 204545, 2045511, 19508081, 179752215, 1613908385, 14202967911, 123028446161, 1052237271735, 8907026785025, 74758478722311, 623053865857841, 5162154289325655, 42558224511290465, 349394287423788711, 2858263098464575121, 23311522539676521975
OFFSET
1,2
COMMENTS
a(n) is the number of n-digit numbers in A366964.
FORMULA
a(n) = 23*8^(n-1) - 41*7^(n-1) + 3*6^n.
a(n) = 21*a(n-1) - 146*a(n-2) + 336*a(n-3) for n > 3.
O.g.f.: x^2*(5 + 6*x)/((1 - 6*x)*(1 - 7*x)*(1 - 8*x)).
E.g.f.: (161*exp(8*x) - 328*exp(7*x) + 168*exp(6*x) - 1)/56.
MATHEMATICA
LinearRecurrence[{21, -146, 336}, {0, 5, 111}, 21]
KEYWORD
nonn,base,easy
AUTHOR
Stefano Spezia, Nov 11 2023
STATUS
approved