login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A336857
The digit sum of n*(n^2 + 1)/2.
0
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, 17, 27, 19, 14, 15, 16, 11, 30, 31, 17, 18, 19, 23, 33, 7, 20, 21, 31, 17, 27, 28, 23, 15, 34, 20, 21, 13, 26, 36, 19, 32, 24, 34, 20, 12, 13, 26, 18, 10, 23, 24, 16
OFFSET
1,2
FORMULA
a(n) = A007953(A006003(n)).
MATHEMATICA
a[n_] := Plus @@ IntegerDigits[n*(n^2 + 1)/2]; Array[a, 100] (* Amiram Eldar, Aug 10 2020 *)
PROG
(Python)
def seq(num):
res = []
for i in range(1, num + 1):
res.append(calc(i))
return res
def calc(num):
sum = 0
start = int((num * (num - 1)) // 2) + 1
for i in range(start, start + num):
sum += i
recip = 0
for i in str(sum):
recip += int(i)
return recip
print(seq(260))
(PARI) a(n) = sumdigits(n*(n^2 + 1)/2) \\ Michel Marcus, Aug 10 2020
CROSSREFS
Sequence in context: A308193 A179274 A104122 * A049467 A131503 A047266
KEYWORD
nonn,base
AUTHOR
Páll Ivan Slamnig, Aug 05 2020
STATUS
approved