A071317 a(n) = a(n-1) + sum of digits of n^2.
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
References
- N. Agronomof, Question 4419, L'Intermédiaire des Math. 21 (1914) 147.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
a071317 n = a071317_list !! n a071317_list = scanl1 (+) a004159_list -- Reinhard Zumkeller, Apr 12 2014
-
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 *)
-
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
Extensions
a(0) = 0 prepended by Reinhard Zumkeller, Apr 12 2014