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”).
%I #57 Dec 17 2019 17:25:47
%S 0,1,23,467,9355,187131,3742683,74853787,1497075995,29941520411,
%T 598830409243,11976608186907,239532163742235,4790643274852891,
%U 95812865497074203,1916257309941516827,38325146198830402075,766502923976608172571,15330058479532163713563,306601169590643274795547
%N Let S be any integer in the range 3 <= S <= 17. 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 two distinct nonzero digits p and q such that p+q=S.
%C This sequence is the building block for the calculation of the sums of positive integers whose decimal notation only uses two distinct, nonzero digits. See the attached pdf document.
%H Pierre-Alain Sallard, <a href="/A328348/a328348_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 (23,-62,40).
%F a(n) = (10*20^n - 19*2^n + 9)/171.
%F From _Stefano Spezia_, Oct 15 2019: (Start)
%F G.f.: x/(1 - 23*x + 62*x^2 - 40*x^3).
%F E.g.f.: (1/171)*exp(x)*(9 - 19*exp(x) + 10*exp(19*x)).
%F a(n) = 23*a(n-1) - 62*a(n-2) + 40*a(n-3) for n > 2.
%F (End)
%F a(n) = 21*a(n-1) - 20*a(n-2) + 2^(n-1) for n > 1. - _Pierre-Alain Sallard_, Dec 10 2019
%e For n=3, the sum of all positive integers whose decimal expansion contains only the digits 5 and 8 (then S=5+8=13) with at most n=3 such digits, i.e., the sum 5 + 8 + 55 + 58 + 85 + 88 + 555 + 558 + 585 + 588 + 855 + 858 + 885 + 888, is equal to a(3)*13=6071.
%e The formula is valid for any other choice of two distinct digits. Other examples: always with n=3 but let's say with the 2 and 3 digits (then S=2+3=5), the sum 2+3+22+23+32+33+222+223+232+233+322+323+332+333 is equal to a(3)*5=2335.
%e Or with the 6 and 7 digits (and which case S=6+7 is the same as with the 5 and 8 digits), the sum 6+7+66+67+...+776+777 is equal to a(3)*13=6071 (same sum as with the 5 and 8 digits).
%o (Python) [(10*20**n-19*2**n+9)/(9*19) for n in range(20)]
%Y Cf. A328350, A328351, A328352, A328353, A328354, A328355, A328356.
%K nonn,base
%O 0,3
%A _Pierre-Alain Sallard_, Oct 13 2019