login
A367249
a(n) is the number of n-digit numbers whose difference between the largest and smallest digits is equal to 8.
7
0, 3, 79, 1323, 18175, 223323, 2555119, 27828363, 292407775, 2990349243, 29943991759, 294872615403, 2864776362175, 27525734996763, 262061152909999, 2475899571994443, 23240879960425375, 216963121865909883, 2015960236625789839, 18656492902684557483, 172056837889322101375
OFFSET
1,2
COMMENTS
a(n) is the number of n-digit numbers in A366965.
FORMULA
a(n) = 17*9^(n-1) - 31*8^(n-1) + 2*7^n.
a(n) = 24*a(n-1) - 191*a(n-2) + 504*a(n-3) for n > 3.
O.g.f.: x^2*(3 + 7*x)/((1 - 7*x)*(1 - 8*x)*(1 - 9*x)).
E.g.f.: (136*exp(9*x) - 279*exp(8*x) + 144*exp(7*x) - 1)/72.
MATHEMATICA
LinearRecurrence[{24, -191, 504}, {0, 3, 79}, 21]
KEYWORD
nonn,base,easy
AUTHOR
Stefano Spezia, Nov 11 2023
STATUS
approved