cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A071317 a(n) = a(n-1) + sum of digits of n^2.

This page as a plain text file.
%I A071317 #24 Jul 12 2023 13:00:53
%S A071317 0,1,5,14,21,28,37,50,60,69,70,74,83,99,115,124,137,156,165,175,179,
%T A071317 188,204,220,238,251,270,288,307,320,329,345,352,370,383,393,411,430,
%U A071317 443,452,459,475,493,515,534,543,553,566,575,582,589,598,611,630,648,658
%N A071317 a(n) = a(n-1) + sum of digits of n^2.
%D A071317 N. Agronomof, Question 4419, L'Intermédiaire des Math. 21 (1914) 147.
%H A071317 Reinhard Zumkeller, <a href="/A071317/b071317.txt">Table of n, a(n) for n = 0..10000</a>
%t A071317 s=0; Do[s=s+Apply[Plus, IntegerDigits[n^2]]; Print[s], {n, 1, 128}]
%t A071317 nxt[{n_,a_}]:={n+1,a+Total[IntegerDigits[(n+1)^2]]}; NestList[nxt,{0,0},60][[All,2]] (* _Harvey P. Dale_, Mar 09 2017 *)
%t A071317 FoldList[#1 + Total@ IntegerDigits[#2^2] &, 0, Range@ 55] (* _Michael De Vlieger_, Mar 25 2017 *)
%t A071317 Accumulate[Plus @@@ IntegerDigits[Range[0, 50]^2]] (* _Giovanni Resta_, Mar 25 2017 *)
%o A071317 (Haskell)
%o A071317 a071317 n = a071317_list !! n
%o A071317 a071317_list = scanl1 (+) a004159_list
%o A071317 -- _Reinhard Zumkeller_, Apr 12 2014
%o A071317 (Python)
%o A071317 from itertools import count, islice, accumulate
%o A071317 def A071317_gen(): # generator of terms
%o A071317     return accumulate(map(lambda n:sum(map(int,str(n**2))),count(0)))
%o A071317 A071317_list = list(islice(A071317_gen(),20)) # _Chai Wah Wu_, Mar 15 2023
%Y A071317 Cf. A007953, A037123, A000788, A051351.
%Y A071317 Partial sums of A004159.
%K A071317 easy,nonn,base
%O A071317 0,3
%A A071317 _Labos Elemer_, May 27 2002
%E A071317 a(0) = 0 prepended by _Reinhard Zumkeller_, Apr 12 2014