login
Let S be any integer in the range 6 <= S <= 24. 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 three distinct nonzero digits d1, d2, d3 such that d1+d2+d3 = S.
8

%I #55 Apr 29 2024 09:08:00

%S 0,1,34,1033,31030,931021,27930994,837930913,25137930670,754137929941,

%T 22624137927754,678724137921193,20361724137901510,610851724137842461,

%U 18325551724137665314,549766551724137133873,16492996551724135539550,494789896551724130756581,14843696896551724116407674,445310906896551724073360953

%N Let S be any integer in the range 6 <= S <= 24. 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 three distinct nonzero digits d1, d2, d3 such that d1+d2+d3 = S.

%C This sequence is the building block for the calculation of the sums of positive integers whose decimal expansion contains only three distinct, nonzero digits: see attached pdf document.

%H Pierre-Alain Sallard, <a href="/A328350/a328350_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 (34,-123,90).

%F a(n) = (20*30^n - 29*3^n + 9)/522.

%F From _Stefano Spezia_, Oct 17 2019: (Start)

%F O.g.f.: x/(1 - 34*x + 123*x^2 - 90*x^3).

%F E.g.f.: (1/522)*(9*exp(x) - 29*exp(3*x) + 20*exp(30*x)).

%F a(n) = 34*a(n-1) - 123*a(n-2) + 90*a(n-3) for n > 2. (End)

%F a(n) = 31*a(n-1) - 30*a(n-2) + 3^n for n > 1. - _Pierre-Alain Sallard_, Dec 15 2019

%e For n=2, the sum of all positive integers whose decimal expansions consist of at most n=2 of the digits 5, 6 or 7, i.e., the sum 5+6+7+55+56+57+65+66+67+75+76+77, is equal to a(2)*(5+6+7) = 612.

%e The formula is valid for any other choice of three distinct digits. Another example: again with n=2, but let's say with the digits 1, 2 and 3, the sum 1+2+3+11+12+13+21+22+23+31+32+33 is equal to a(2)*(1+2+3) = 204.

%t Array[(20*30^# - 29*3^# + 9)/522 &, 20, 0] (* or *)

%t LinearRecurrence[{34, -123, 90}, {0, 1, 34}, 20] (* _Paolo Xausa_, Apr 29 2024 *)

%o (Python) [(20*30**n-29*3**n+9)//522 for n in range(20)]

%Y Cf. A328348, A328351, A328352, A328353, A328354, A328355, A328356.

%K nonn,base,easy

%O 0,3

%A _Pierre-Alain Sallard_, Oct 13 2019

%E Needs editing. - _N. J. A. Sloane_, Dec 12 2019