login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A328351
Let S be any integer in the range 10 <= S <= 30. Sequence has the property that a(n)*S is the sum of all positive integers whose decimal expansion has <= n digits and contains at most four distinct nonzero digits d1, d2, d3 and d4 such that d1+d2+d3+d4=S.
8
0, 1, 45, 1821, 72925, 2917341, 116695005, 4667805661, 186712248285, 7468490018781, 298739601100765, 11949584045428701, 477983361822740445, 19119334472931987421, 764773378917368975325, 30590935156695116926941, 1223637406267806108733405, 48945496250712250075959261
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.
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)]
KEYWORD
nonn,base
AUTHOR
STATUS
approved