login
Sum of digits of numbers between 0 and (10^n)-1.
12

%I #31 Oct 28 2022 17:10:15

%S 0,45,900,13500,180000,2250000,27000000,315000000,3600000000,

%T 40500000000,450000000000,4950000000000,54000000000000,

%U 585000000000000,6300000000000000,67500000000000000,720000000000000000,7650000000000000000,81000000000000000000

%N Sum of digits of numbers between 0 and (10^n)-1.

%D Edward J. Barbeau, Murray S. Klamkin & William O. J. Moser, Five Hundred Mathematical Challenges, Problem 284 at pp. 142-143 (1995).

%H Vincenzo Librandi, <a href="/A034967/b034967.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (20, -100).

%F a(n) = 45*n*10^(n-1).

%F a(n) = 20*a(n-1) - 100*a(n-2), a(0)=0, a(1)=45. - _Harvey P. Dale_, Oct 09 2011

%F G.f.: (45*x)/(10*x-1)^2. - _Harvey P. Dale_, Oct 09 2011

%F a(n) = (9*n*10^n)/2. - _Harvey P. Dale_, Apr 23 2018

%p seq(45*n*10^(n-1),n=0..30); # _Robert Israel_, Jun 29 2018

%t Table[45n 10^(n-1),{n,0,20}] (* or *) LinearRecurrence[{20,-100},{0,45},21] (* _Harvey P. Dale_, Oct 09 2011 *)

%o (PARI) a(n)=45*n*10^(n-1) \\ _Charles R Greathouse IV_, Oct 07 2015

%o (Magma) [45*n*10^(n-1): n in [0..30]]; // _Vincenzo Librandi_, Jun 30 2018

%Y Cf. A037123.

%K nonn,easy,base

%O 0,2

%A _Felice Russo_

%E More terms from _James A. Sellers_, Jan 19 2000