

A003132


Sum of squares of digits of n.
(Formerly M3355)


91



0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 2, 5, 10, 17, 26, 37, 50, 65, 82, 4, 5, 8, 13, 20, 29, 40, 53, 68, 85, 9, 10, 13, 18, 25, 34, 45, 58, 73, 90, 16, 17, 20, 25, 32, 41, 52, 65, 80, 97, 25, 26, 29, 34, 41, 50, 61, 74, 89, 106, 36, 37, 40, 45, 52, 61, 72, 85, 100, 117, 49
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

It is easy to show that a(n) < 81*(log(n)+1) [log = base 10].  Stefan Steinerberger, Mar 25 2006
It is known that a(0)=0 and a(1)=1 are the only fixed points of this map. For more information about iterations of this map, see A007770, A099645 and A000216 ff.  M. F. Hasler, May 24 2009


REFERENCES

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).


LINKS

T. D. Noe, Table of n, a(n) for n = 0..10000
J.P. Allouche and J. Shallit, The ring of kregular sequences, II, Theoret. Computer Sci., 307 (2003), 329; [preprint from author's web page, PostScript format].
Arthur Porges, A set of eight numbers, Amer. Math. Monthly 52 (1945), 379382.
B. M. Stewart, Sums of functions of digits, Canad. J. Math., 12 (1960), 374389.
Robert Walker, Self Similar Sloth Canon Number Sequences
Index entries for Colombian or self numbers and related sequences


FORMULA

a(n) = n^220*n*floor(n/10)+81*sum{k>0,floor(n/10^k)^2}+20*sum{k>0,floor(n/10^k)*(floor(n/10^k)floor(n/10^(k+1)))}.  Hieronymus Fischer, Jun 17 2007
a(10n+k) = a(n)+k^2, 0 <= k < 10.  Hieronymus Fischer, Jun 17 2007
a(n) = A007953(A048377(n))  A007953(n).  Reinhard Zumkeller, Jul 10 2011


MAPLE

A003132 := proc(n) local d; add(d^2, d=convert(n, base, 10)) ; end proc: # R. J. Mathar, Oct 16 2010


MATHEMATICA

Table[Sum[DigitCount[n][[i]]*i^2, {i, 1, 9}], {n, 0, 40}] (* Stefan Steinerberger, Mar 25 2006 *)
Total/@(IntegerDigits[Range[0, 80]]^2) (* Harvey P. Dale, Jun 20 2011 *)


PROG

(PARI) A003132(n)=norml2(digits(n)) \\ M. F. Hasler, May 24 2009, updated Apr 12 2015
(Haskell)
a003132 0 = 0
a003132 x = d ^ 2 + a003132 x' where (x', d) = divMod x 10
 Reinhard Zumkeller, May 10 2015, Aug 07 2012, Jul 10 2011
(MAGMA) [0] cat [&+[d^2: d in Intseq(n)]: n in [1..80]]; // Bruno Berselli, Feb 01 2013


CROSSREFS

Cf. A052034, A052035.
Cf. A007953, A055017, A076313, A076314.
Concerning iterations of this map, see A003621, A039943, A099645, A031176, A007770, A000216 (starting with 2), A000218 (starting with 3), A080709 (starting with 4, this is the only nontrivial limit cycle), A000221 (starting with 5), A008460 (starting with 6), A008462 (starting with 8), A008463 (starting with 9), A139566 (starting with 15), A122065 (starting with 74169).  M. F. Hasler, May 24 2009
Cf. A080151, A051885 (record values and where they occur).
Cf. A257588.
Sequence in context: A257587 A257588 A303269 * A062331 A069940 A153211
Adjacent sequences: A003129 A003130 A003131 * A003133 A003134 A003135


KEYWORD

nonn,easy,base,nice


AUTHOR

N. J. A. Sloane


EXTENSIONS

More terms from Stefan Steinerberger, Mar 25 2006
Terms checked using the given PARI code, M. F. Hasler, May 24 2009
Replaced the Maple program with a version which works also for arguments with >2 digits, R. J. Mathar, Oct 16 2010
Added ref to Porges. Steinhaus also treated iterations of this function in his Polish book Sto zada´n, but I don't have access to it.  Don Knuth, Sep 07 2015


STATUS

approved



