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”).

A328350
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
0, 1, 34, 1033, 31030, 931021, 27930994, 837930913, 25137930670, 754137929941, 22624137927754, 678724137921193, 20361724137901510, 610851724137842461, 18325551724137665314, 549766551724137133873, 16492996551724135539550, 494789896551724130756581, 14843696896551724116407674, 445310906896551724073360953
OFFSET
0,3
COMMENTS
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.
FORMULA
a(n) = (20*30^n - 29*3^n + 9)/522.
From Stefano Spezia, Oct 17 2019: (Start)
O.g.f.: x/(1 - 34*x + 123*x^2 - 90*x^3).
E.g.f.: (1/522)*(9*exp(x) - 29*exp(3*x) + 20*exp(30*x)).
a(n) = 34*a(n-1) - 123*a(n-2) + 90*a(n-3) for n > 2. (End)
a(n) = 31*a(n-1) - 30*a(n-2) + 3^n for n > 1. - Pierre-Alain Sallard, Dec 15 2019
EXAMPLE
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.
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.
MATHEMATICA
Array[(20*30^# - 29*3^# + 9)/522 &, 20, 0] (* or *)
LinearRecurrence[{34, -123, 90}, {0, 1, 34}, 20] (* Paolo Xausa, Apr 29 2024 *)
PROG
(Python) [(20*30**n-29*3**n+9)//522 for n in range(20)]
KEYWORD
nonn,base,easy
AUTHOR
EXTENSIONS
Needs editing. - N. J. A. Sloane, Dec 12 2019
STATUS
approved