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”).

A071317
a(n) = a(n-1) + sum of digits of n^2.
7
0, 1, 5, 14, 21, 28, 37, 50, 60, 69, 70, 74, 83, 99, 115, 124, 137, 156, 165, 175, 179, 188, 204, 220, 238, 251, 270, 288, 307, 320, 329, 345, 352, 370, 383, 393, 411, 430, 443, 452, 459, 475, 493, 515, 534, 543, 553, 566, 575, 582, 589, 598, 611, 630, 648, 658
OFFSET
0,3
REFERENCES
N. Agronomof, Question 4419, L'Intermédiaire des Math. 21 (1914) 147.
LINKS
MATHEMATICA
s=0; Do[s=s+Apply[Plus, IntegerDigits[n^2]]; Print[s], {n, 1, 128}]
nxt[{n_, a_}]:={n+1, a+Total[IntegerDigits[(n+1)^2]]}; NestList[nxt, {0, 0}, 60][[All, 2]] (* Harvey P. Dale, Mar 09 2017 *)
FoldList[#1 + Total@ IntegerDigits[#2^2] &, 0, Range@ 55] (* Michael De Vlieger, Mar 25 2017 *)
Accumulate[Plus @@@ IntegerDigits[Range[0, 50]^2]] (* Giovanni Resta, Mar 25 2017 *)
PROG
(Haskell)
a071317 n = a071317_list !! n
a071317_list = scanl1 (+) a004159_list
-- Reinhard Zumkeller, Apr 12 2014
(Python)
from itertools import count, islice, accumulate
def A071317_gen(): # generator of terms
return accumulate(map(lambda n:sum(map(int, str(n**2))), count(0)))
A071317_list = list(islice(A071317_gen(), 20)) # Chai Wah Wu, Mar 15 2023
CROSSREFS
Partial sums of A004159.
Sequence in context: A306989 A003248 A353974 * A167201 A336145 A269871
KEYWORD
easy,nonn,base
AUTHOR
Labos Elemer, May 27 2002
EXTENSIONS
a(0) = 0 prepended by Reinhard Zumkeller, Apr 12 2014
STATUS
approved