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.

Previous Showing 11-15 of 15 results.

A099646 Function f(n) = 1 + Sum(digit^2 of n) is iterated and a(n) is the length of terminal cycle at initial value n.

Original entry on oeis.org

9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 1, 9, 9, 9, 9, 9, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9
Offset: 1

Views

Author

Labos Elemer, Nov 11 2004

Keywords

Comments

Iteration g(x) applied in A031176 is slightly modified to obtain actual function: f(x) = 1 + g(x). Cases of a(n) = 1 (n = 35, 36, 46, 53, 57, 63, 64, 75, 135, ...) are analogous to happy numbers A007770.

Examples

			For n = 1: iteration-list= {1,2,5,26,41,18,66,73,59,107,51,[27,54,42,21,6,37,59,107,51],27...
with t = 11 transient and c = a(1) = 9, the cycle-length;
For n = 35: list={36,46,53,[35],35,...} with transient t = 3, c = a(35) = 1 the cycle-length.
		

Crossrefs

Programs

  • Mathematica
    ed[x_] :=IntegerDigits[x]; f[x_] :=Apply[Plus, ed[x]^2]+1; itef[x_, ho_] :=NestList[f, x, ho]; tmc=Table[Length[Union[itef[w, 100]]], {w, 1, 256}]; c1=Table[Min[Flatten[Position[itef[w, Length[Union[itef[w, 100]]]] -Last[itef[w, Length[Union[itef[w, 100]]]]], 0]]], {w, 1, 256}]; (* transient-length= *) c1-1; (* cycle-length= *) c=tmc-(c1-1); (* ho=iteration number is chosen by trial and error *) (* program provides t, t+c and c lengths[=unknown-in-advance] for any similar iterations if f modified *)
    (* Second program: *)
    With[{nn = 10^3}, Table[Function[s, Length@ KeySelect[s, Length@ Lookup[s, #] > 1 &]]@ PositionIndex@ NestList[1 + Total[ IntegerDigits[#]^2] &, n, nn], {n, 105}]] (* Michael De Vlieger, Jul 24 2017 *)

A152077 Length of the trajectory of the map x->A003132(x) started at x=n^2 up to the end of its first period.

Original entry on oeis.org

1, 8, 12, 8, 11, 16, 5, 12, 11, 2, 18, 13, 17, 17, 13, 11, 11, 11, 13, 9, 13, 14, 11, 11, 11, 19, 12, 5, 12, 12, 17, 14, 15, 17, 13, 14, 17, 6, 4, 9, 14, 14, 16, 17, 13, 9, 9, 11, 14, 11, 15, 14, 11, 14, 11, 14, 11, 7, 13, 16, 17, 12, 15, 7, 6, 4, 18, 15, 14, 5, 9, 10, 12, 16, 13, 15, 12, 12
Offset: 1

Views

Author

R. J. Mathar, Sep 16 2009

Keywords

Comments

This accumulates the length of the "transient" or "pre-periodic" part of the trajectory started at n^2 plus the length of the first period.

Examples

			a(5)=11 since the trajectory starting at x=5^2 is 25, 29, 85, 89, 145, 42, 20, 4, 16, 37, 58 the next term 89 is already there.
a(10)= 2 since the trajectory starting at x=10^2 is 100,1 and the next term is again the 1.
a(11)= 18 because the trajectory is 121, 6, 36, 45, 41, 17, 50, 25, 29, 85, 89, 145, 42, 20, 4, 16, 37, 58, the next 89 is already there.
		

Crossrefs

Formula

a(n) = A099645(n^2)+A031176(n^2) .

A099647 Function f[n]=1+Sum[digit^2 of n] is iterated as in A099646. Values x for which A099646[x]=1 are listed here. These terms are analogous to happy-numbers [=A007770].

Original entry on oeis.org

35, 36, 46, 53, 57, 63, 64, 75, 135, 138, 153, 156, 165, 183, 237, 245, 246, 254, 264, 273, 279, 297, 305, 306, 315, 318, 327, 334, 343, 347, 350, 351, 360, 372, 374, 381, 388, 406, 425, 426, 433, 437, 452, 460, 462, 473, 503, 507, 513, 516, 524, 530, 531
Offset: 1

Views

Author

Labos Elemer, Nov 11 2004

Keywords

Comments

Iteration g[x] applied in A031176 is slightly modified to obtain actual function to iterate here: f[x]=1+g[x].Initial values resulting in fixed points are collected.

Examples

			n=35 is here because list={36,46,53,[35],35,...} with transient t=3, c=1 cycle-length.
		

Crossrefs

Programs

  • Mathematica
    ed[x_] :=IntegerDigits[x]; f[x_] :=Apply[Plus, ed[x]^2]+1; itef[x_, ho_] :=NestList[f, x, ho]; tmc=Table[Length[Union[itef[w, 100]]], {w, 1, 256}]; c1=Table[Min[Flatten[Position[itef[w, Length[Union[itef[w, 100]]]] -Last[itef[w, Length[Union[itef[w, 100]]]]], 0]]], {w, 1, 256}]; Flatten[Position[tmc-(c1-1), 1]]

A364682 Number of iterations of the "x -> sum of squares of digits of x" map (A003132) for n to converge to either 0, 1 or the 8-cycle (37,58,89,145,42,20,4,16).

Original entry on oeis.org

1, 1, 2, 6, 1, 5, 10, 6, 6, 5, 2, 3, 6, 3, 7, 4, 1, 6, 4, 5, 1, 6, 7, 4, 2, 4, 3, 7, 4, 3, 6, 3, 4, 5, 5, 6, 9, 1, 3, 6, 2, 7, 1, 5, 5, 8, 5, 4, 7, 5, 5, 4, 4, 6, 8, 6, 3, 5, 1, 3, 10, 2, 3, 9, 5, 3, 8, 3, 3, 6, 6, 6, 7, 2, 4, 5, 3, 3, 5, 4, 6, 4, 4, 3, 7, 2
Offset: 0

Views

Author

Chai Wah Wu, Aug 02 2023

Keywords

Comments

The initial number counts as iteration 1.

Crossrefs

Programs

  • Python
    def A364682(n):
        c = 1
        while n not in {0,1,37,58,89,145,42,20,4,16}:
            n = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(n))
            c += 1
        return c

Formula

a(n) <= A193995(n) with equality if and only if n is a Happy number (A007770).
a(n) = 1 if and only if n is in A039943.
a(n) = A099645(n)+1.

A360697 The sum of the squares of the digits of n, repeated until reaching a single-digit number.

Original entry on oeis.org

0, 1, 4, 9, 4, 4, 4, 1, 4, 4, 1, 2, 5, 1, 4, 4, 4, 4, 4, 1, 4, 5, 8, 1, 4, 4, 4, 4, 1, 4, 9, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 2, 1, 4, 4, 1, 4, 4, 4, 1, 2, 4, 4, 4, 1, 4, 4, 1, 4, 4, 1, 4, 4, 1
Offset: 0

Views

Author

Will Nicholes, Feb 16 2023

Keywords

Comments

Square the digits of n, then sum the squares. Repeat the process until the sum is less than 10.

Examples

			For n=28, the sum of the squares of the digits gives 4+64 = 68. Repeating the process gives 36+64 = 100; repeating once more gives 1+0+0 = 1. Therefore a(28) is 1.
a(n) = 4 for 72 of the first 100 n (0 to 99 inclusive.)
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Plus @@ (IntegerDigits[n]^2); a[n_] := NestWhile[f, f[n], # > 9 &]; Array[a, 100, 0] (* Amiram Eldar, Feb 17 2023 *)
Previous Showing 11-15 of 15 results.