The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A130835 Sum of all numbers having n or fewer digits and having the sum of their digits equal to n. 5

%I #39 Feb 22 2020 22:59:55

%S 1,33,1110,38885,1399986,51333282,1906666476,71499999285,

%T 2701111108410,102631111100848,3917722222183045,150126888888738762,

%U 5771538888888311735,222499777777775552780,8598259999999991401740,332968856666666633369781,12918171566666666537484951

%N Sum of all numbers having n or fewer digits and having the sum of their digits equal to n.

%H Alois P. Heinz, <a href="/A130835/b130835.txt">Table of n, a(n) for n = 1..626</a>

%F a(n) = (10^n-1)/9 * [x^n] ((x^10-1)/(x-1))^n. - _Alois P. Heinz_, Feb 07 2012

%F a(n) = A000042(n) * A167403(n) = A002275(n) * A167403(n). - _Alois P. Heinz_, Aug 16 2018

%e Take n = 3. The numbers to be summed are 111, 3, 30, 300, 210, 201, 120, 102, 21 and 12, which add to 1110.

%p A007953 := proc(n) add(i,i=convert(n,base,10)) ; end: A130835 := proc(n) local a,i; a := 0 ; for i from 1 to 10^n-1 do if A007953(i) = n then a := a+i ; fi ; od ; RETURN(a) ; end: seq(A130835(n),n=1..4) ; # _R. J. Mathar_, Aug 01 2007

%p # second Maple program:

%p b:= proc(n, i) option remember; `if`(n=0, 1,

%p `if`(i=0, 0, add(b(n-j, i-1), j=0..min(n, 9))))

%p end:

%p a:= n-> b(n, n)*(10^n-1)/9:

%p seq(a(n), n=1..20); # _Alois P. Heinz_, Nov 02 2009

%Y Cf. A000042, A002275, A007953, A167403, A211072, A331672, A331673.

%K base,nonn

%O 1,2

%A _J. M. Bergot_, Jul 18 2007

%E a(4)-a(6) from _R. J. Mathar_, Aug 01 2007

%E a(7)-a(12) from _Donovan Johnson_, Jul 02 2009

%E More terms from _Alois P. Heinz_, Nov 02 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 3 09:48 EDT 2024. Contains 373057 sequences. (Running on oeis4.)