login
A101291
Sum of all numbers with n digits.
7
45, 4905, 494550, 49495500, 4949955000, 494999550000, 49499995500000, 4949999955000000, 494999999550000000, 49499999995500000000, 4949999999955000000000, 494999999999550000000000, 49499999999995500000000000, 4949999999999955000000000000
OFFSET
1,1
COMMENTS
All terms are multiples of 45: A101291 = 45*(1, 109, 10990, 1099900, 109999000, ...), cf. formula. - M. F. Hasler, Nov 26 2008
All terms have digital root 9. - Halfdan Skjerning, Jun 18 2019
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]
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
EXAMPLE
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.
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 *)
PROG
(PARI) A101291(n)=(n=10^(n-1))*(11*n-1)\2*9 \\ M. F. Hasler, Nov 26 2008
(Magma) [9*(11*10^(2*n-2) -10^(n-1))/2: n in [1..15]]; // G. C. Greubel, Jul 07 2019
(Sage) [9*(11*10^(2*n-2) -10^(n-1))/2 for n in (1..15)] # G. C. Greubel, Jul 07 2019
(GAP) List([1..15], n-> 9*(11*10^(2*n-2) -10^(n-1))/2 ) # G. C. Greubel, Jul 07 2019
CROSSREFS
First differences of A037182.
Sequence in context: A328356 A375052 A093533 * A061542 A037182 A178632
KEYWORD
nonn,base,easy
AUTHOR
Jorge Coveiro, Dec 21 2004
EXTENSIONS
More terms from Robert G. Wilson v, Dec 24 2004
STATUS
approved