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.

A003124 One of the basic cycles in the x->3x-1 (x odd) or x/2 (x even) problem.

Original entry on oeis.org

17, 50, 25, 74, 37, 110, 55, 164, 82, 41, 122, 61, 182, 91, 272, 136, 68, 34, 17, 50, 25, 74, 37, 110, 55, 164, 82, 41, 122, 61, 182, 91, 272, 136, 68, 34, 17, 50, 25, 74, 37, 110, 55, 164, 82, 41, 122, 61, 182, 91, 272, 136, 68, 34
Offset: 0

Views

Author

Keywords

Examples

			17 is odd, so the next term is 3 * 17 - 1 = 50.
50 is even, so the next term is 50/2 = 25.
		

References

  • Richard K. Guy, Unsolved Problems in Number Theory, E16.
  • H.-O. Peitgen et al., Chaos and Fractals, Springer, p. 33.

Programs

  • Mathematica
    Abs[NestList[If[EvenQ[#], #/2, 3# + 1]&, -17, 100]] (* Alonso del Arte, May 19 2015 *)
  • PARI
    a=34;A003124=vector(100,i,a=if(bittest(a,0),3*a-1,a/2)) \\ M. F. Hasler, Aug 29 2015
    
  • PARI
    A003124(n,a=17)={for(i=1,n%17,a=if(bittest(a,0),3*a-1,a\2));a} \\ M. F. Hasler, Aug 29 2015