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.

A118881 Square of sum of decimal digits of n.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 36, 49, 64, 81, 100, 121, 144
Offset: 0

Views

Author

Giovanni Teofilatto, May 25 2006

Keywords

Comments

a(k) = k iff k = 0, 1, 81; also, the only solution to the double equation a(k) = m and a(m) = k with k < m is (169, 256) (proof in Diophante link, 2ème jonglerie). - Bernard Schott, Mar 08 2021
If the map i->a(i) is iterated starting at i = n, the trajectory will eventually reach one ot the three cycles (1) (if n == +-1 mod 9), (169,256) (if n == 2,4,5,7 mod 9), or (81) (if n == 0 mod 3). - N. J. A. Sloane, Mar 17 2025

Examples

			From _R. J. Mathar_, Jul 08 2012: (Start)
Trajectories of the map x->a(x), A177148:
1 ->1 ->1 ->1 ->1 ->1 ->1 ->1 ->1 ->...
2 ->4 ->16 ->49 ->169 ->256 ->169 ->256 ->169 ->...
3 ->9 ->81 ->81 ->81 ->81 ->81 ->81 ->81 ->...
4 ->16 ->49 ->169 ->256 ->169 ->256 ->169 ->256 ->...
5 ->25 ->49 ->169 ->256 ->169 ->256 ->169 ->256 ->...
6 ->36 ->81 ->81 ->81 ->81 ->81 ->81 ->81 ->...
7 ->49 ->169 ->256 ->169 ->256 ->169 ->256 ->169 ->...
8 ->64 ->100 ->1 ->1 ->1 ->1 ->1 ->1 ->... (End)
		

Crossrefs

Cf. A007953.

Programs

  • Maple
    read("transforms") :
    A118881 := proc(n)
            digsum(n)^2 ;
    end proc: # R. J. Mathar, Jul 08 2012
  • Mathematica
    Table[Total[IntegerDigits[n]]^2,{n,0,70}] (* Harvey P. Dale, Jul 31 2012 *)
  • PARI
    a(n) = sumdigits(n)^2; \\ Michel Marcus, Mar 08 2021
    
  • Python
    def a(n): return sum(map(int, str(n)))**2
    print([a(n) for n in range(67)]) # Michael S. Branicky, Nov 19 2021

Formula

a(n) = A007953(n)^2. [R. J. Mathar, Apr 22 2010]