A101291 Sum of all numbers with n digits.
45, 4905, 494550, 49495500, 4949955000, 494999550000, 49499995500000, 4949999955000000, 494999999550000000, 49499999995500000000, 4949999999955000000000, 494999999999550000000000, 49499999999995500000000000, 4949999999999955000000000000
Offset: 1
Examples
a(1) = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45; a(2) = 10 + 11 + 12 + 13 + 14 + ... + 97 + 98 + 99 = 4905; a(3) = 100 + 101 + 102 + 103 + ... + 997 + 998 + 999 = 494550.
References
- Edward J. Barbeau, Murray S. Klamkin, William O. J. Moser, Five Hundred Mathematical Challenges, Problem 34 page 60, MAA Washington DC 1995. [Lekraj Beedassy, Mar 02 2017]
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..100
- Index entries for linear recurrences with constant coefficients, signature (110, -1000).
Crossrefs
First differences of A037182.
Programs
-
GAP
List([1..15], n-> 9*(11*10^(2*n-2) -10^(n-1))/2 ); # G. C. Greubel, Jul 07 2019
-
Magma
[9*(11*10^(2*n-2) -10^(n-1))/2: n in [1..15]]; // G. C. Greubel, Jul 07 2019
-
Maple
sum(x,x=1..9),sum(x,x=10..99),sum(x,x=100..999),sum(x,x=1000..9999),sum(x,x=10000..99999),sum(x,x=100000..999999),sum(x,x=1000000..9999999),sum(x,x=10000000..99999999);
-
Mathematica
f[n_] := 10^n(10^n - 1)/2; Table[f[n] - f[n - 1], {n, 15}] (* Robert G. Wilson v Dec 24 2004 *)
-
PARI
A101291(n)=(n=10^(n-1))*(11*n-1)\2*9 \\ M. F. Hasler, Nov 26 2008
-
Sage
[9*(11*10^(2*n-2) -10^(n-1))/2 for n in (1..15)] # G. C. Greubel, Jul 07 2019
Formula
a(n) = 99*100^n/200 - 9*10^n/20 = (99*100^n - 90*10^n)/200 = 9*(11*10^(n-1) - 1)*10^(n-1)/2 = 45*(11*10^(2n-3) - 10^(n-2)). - M. F. Hasler, Nov 26 2008
Expanding and rearranging, we have a(n) = (494+1)*10^(2n-3) - (100-55)*10^(n-2) = 494*10^(2n-3) + (10^(n-3) - 1)*10^n + 55*10^(n-2) = 494*10^(2n-3) + 99...9 (n-3 times)*10^n + 55*10^(n-2). Thus, for n>2, a(n) = 494, followed by (n-3) times digit 9, followed by 55, followed by (n-2) times digit 0, i.e., 494 99...9(n-3) times 55 00...0(n-2) times. - Lekraj Beedassy, Mar 02 2017
G.f.: 45*x*(1 - x)/(1 - 110*x + 1000*x^2). - Arkadiusz Wesolowski, Jul 12 2012
Extensions
More terms from Robert G. Wilson v, Dec 24 2004
Comments