%I #50 Dec 26 2019 05:37:28
%S 0,1,45,1821,72925,2917341,116695005,4667805661,186712248285,
%T 7468490018781,298739601100765,11949584045428701,477983361822740445,
%U 19119334472931987421,764773378917368975325,30590935156695116926941,1223637406267806108733405,48945496250712250075959261
%N 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.
%C 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.
%H Pierre-Alain Sallard, <a href="/A328351/a328351_2.pdf">Integers sequences A328348 and A328350 to A328356</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (45,-204,160).
%F a(n) = (30*40^n-39*4^n+9)/1053.
%F From _Stefano Spezia_, Oct 15 2019: (Start)
%F G.f.: x/(1 - 45*x + 204*x^2 - 160*x^3).
%F E.g.f.: (1/351)*exp(x)*(3 - 13*exp(3*x) + 10*exp(39*x)).
%F a(n) = 45*a(n-1) - 204*a(n-2) + 160*a(n-3) for n > 2.
%F (End)
%F a(n) = 41*a(n-1) - 40*a(n-2) + 4^(n-1) for n > 1. - _Pierre-Alain Sallard_, Dec 22 2019
%e 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.
%e 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.
%t CoefficientList[Series[x/(1 - 45 x + 204 x^2 - 160 x^3), {x, 0, 17}], x] (* _Michael De Vlieger_, Dec 23 2019 *)
%o (Python) [(30*40**n-39*4**n+9)//1053 for n in range(20)]
%Y Cf. A328348, A328350, A328352, A328353, A328354, A328355, A328356.
%K nonn,base
%O 0,3
%A _Pierre-Alain Sallard_, Oct 13 2019
|