login
A367247
a(n) is the number of n-digit numbers whose difference between the largest and smallest digits is equal to 6.
7
0, 7, 131, 1609, 16415, 150817, 1296191, 10641169, 84520175, 654958177, 4980233951, 37312922929, 276288797135, 2026564724737, 14750977566911, 106695818055889, 767748717541295, 5500729672814497, 39270143125479071, 279511731951144049, 1984459091985376655, 14059238393314971457
OFFSET
1,2
COMMENTS
a(n) is the number of n-digit numbers in A366963.
FORMULA
a(n) = 27*7^(n-1) - 47*6^(n-1) + 4*5^n.
a(n) = 21*a(n-1) - 146*a(n-2) + 336*a(n-3) for n > 3.
O.g.f.: x^2*(7 + 5*x)/((1 - 5*x)*(1 - 6*x)*(1 - 7*x)).
E.g.f.: (162*exp(7*x) - 329*exp(6*x) + 168*exp(5*x) - 1)/42.
MATHEMATICA
LinearRecurrence[{18, -107, 210}, {0, 7, 131}, 22]
KEYWORD
nonn,base,easy
AUTHOR
Stefano Spezia, Nov 11 2023
STATUS
approved