OFFSET
0,3
COMMENTS
This sequence is the building block for the calculation of the sums of positive integers whose decimal notation only uses four distinct, nonzero digits: see the attached pdf document.
LINKS
Pierre-Alain Sallard, Integers sequences A328348 and A328350 to A328356
Index entries for linear recurrences with constant coefficients, signature (45,-204,160).
FORMULA
a(n) = (30*40^n-39*4^n+9)/1053.
From Stefano Spezia, Oct 15 2019: (Start)
G.f.: x/(1 - 45*x + 204*x^2 - 160*x^3).
E.g.f.: (1/351)*exp(x)*(3 - 13*exp(3*x) + 10*exp(39*x)).
a(n) = 45*a(n-1) - 204*a(n-2) + 160*a(n-3) for n > 2.
(End)
a(n) = 41*a(n-1) - 40*a(n-2) + 4^(n-1) for n > 1. - Pierre-Alain Sallard, Dec 22 2019
EXAMPLE
For n=2, the sum of all positive integers whose decimal notation is only made of the 4,5,6 or 7 digit with at most n=2 such digits, i.e., the sum 4+5+6+7+44+45+46+47+54+55+56+57+64+65+66+67+74+75+76+77, is equal to (4+5+6+7)*a(2)=990.
The formula is valid for any other quadruple, as soon as the four digits are different from each other. Another example: always with n=2 but let's say with the 1,2,3 and 4 digits, the sum 1+2+3+4+11+12+13+14+21+22+23+24+31+32+33+34+41+42+43+44 is equal to a(2)*(1+2+3+4) = 450.
MATHEMATICA
CoefficientList[Series[x/(1 - 45 x + 204 x^2 - 160 x^3), {x, 0, 17}], x] (* Michael De Vlieger, Dec 23 2019 *)
PROG
(Python) [(30*40**n-39*4**n+9)//1053 for n in range(20)]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Pierre-Alain Sallard, Oct 13 2019
STATUS
approved