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.

Showing 1-1 of 1 results.

A308006 Iterate the map x->A308005(x) starting at x=n; a(n) is the number of steps before the first repeated term is encountered.

Original entry on oeis.org

3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 0, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1
Offset: 0

Views

Author

N. J. A. Sloane, May 12 2019

Keywords

Examples

			0 -> 11 -> 220 -> 33 -> 220 -> ... and a number is repeated at step 4, so a(0)=3.
1 -> 110 -> 231 -> 231 -> 231 -> ..., so a(1) = 2.
22 -> 22 -> 22 -> ... is a fixed point, so a(22) = 0.
		

Crossrefs

Cf. A308005.

Programs

  • Maple
    # using Maple procedure A308006 from that sequence
    f:= proc(n) local t,S,i;
      S:= {n};
      t:= n;
      do
        t:= A308005(t);
        if member(t,S) then return nops(S)-1 fi;
        S:= S union {t};
      od
    end proc:
    map(f, [$0..100]); # Robert Israel, May 14 2019
Showing 1-1 of 1 results.