login
The digit sum of n*(n^2 + 1)/2.
0

%I #26 May 10 2021 07:40:02

%S 1,5,6,7,11,3,13,8,18,10,14,15,7,20,21,13,17,18,19,5,15,16,20,21,22,

%T 17,27,19,14,15,16,11,30,31,17,18,19,23,33,7,20,21,31,17,27,28,23,15,

%U 34,20,21,13,26,36,19,32,24,34,20,12,13,26,18,10,23,24,16

%N The digit sum of n*(n^2 + 1)/2.

%F a(n) = A007953(A006003(n)).

%t a[n_] := Plus @@ IntegerDigits[n*(n^2 + 1)/2]; Array[a, 100] (* _Amiram Eldar_, Aug 10 2020 *)

%o (Python)

%o def seq(num):

%o res = []

%o for i in range(1, num + 1):

%o res.append(calc(i))

%o return res

%o def calc(num):

%o sum = 0

%o start = int((num * (num - 1)) // 2) + 1

%o for i in range(start, start + num):

%o sum += i

%o recip = 0

%o for i in str(sum):

%o recip += int(i)

%o return recip

%o print(seq(260))

%o (PARI) a(n) = sumdigits(n*(n^2 + 1)/2) \\ _Michel Marcus_, Aug 10 2020

%Y Cf. A007953, A006003.

%K nonn,base

%O 1,2

%A _Páll Ivan Slamnig_, Aug 05 2020