login
Sum of digits of n-th triangular number.
4

%I #26 Mar 31 2024 15:31:07

%S 0,1,3,6,1,6,3,10,9,9,10,12,15,10,6,3,10,9,9,10,3,6,10,15,3,10,9,18,

%T 10,12,15,19,15,12,19,9,18,10,12,15,10,15,12,19,18,9,10,12,15,10,15,

%U 12,19,9,18,10,21,15,10,15,12,19,18,9,10,12,6,19,15,12,19,18,18,10,21,15,19,6,12,10

%N Sum of digits of n-th triangular number.

%H Robert Israel, <a href="/A004157/b004157.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = A007953(A000217(n)). - _Robert Israel_, Jun 18 2015

%p seq(convert(convert(n*(n+1)/2,base,10),`+`), n=0..100); # _Robert Israel_, Jun 18 2015

%t Table[Plus@@IntegerDigits@(n (n + 1) / 2), {n, 0, 90}] (* _Vincenzo Librandi_, Jun 18 2015 *)

%t Total[IntegerDigits[#]]&/@Accumulate[Range[0,100]] (* _Harvey P. Dale_, Mar 31 2024 *)

%o (Magma) [&+Intseq(n*(n+1) div 2): n in [0..80] ]; // _Vincenzo Librandi_, Jun 18 2015

%o (PARI) a(n) = sumdigits(n*(n+1)/2); \\ _Michel Marcus_, Jun 18 2015

%Y Cf. A000217, A007953, A062688, A145389.

%K nonn,base

%O 0,3

%A _N. J. A. Sloane_