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.

A064685 Length of orbit of 2n+1 in the 3x+1 problem.

Original entry on oeis.org

1, 8, 6, 17, 20, 15, 10, 18, 13, 21, 8, 16, 24, 112, 19, 107, 27, 14, 22, 35, 110, 30, 17, 105, 25, 25, 12, 113, 33, 33, 20, 108, 28, 28, 15, 103, 116, 15, 23, 36, 23, 111, 10, 31, 31, 93, 18, 106, 119, 26, 26, 88, 39, 101, 114, 70, 13, 34, 21, 34, 96, 47, 109, 47, 122
Offset: 0

Views

Author

Jon Perry, Oct 10 2001

Keywords

Examples

			E.g. orbit(3) = 3->10->5->16->8->4->2->1, so length of chain = 8. So a(1) = 8.
		

Programs

  • ARIBAS
    function a064685(maxarg: integer); var n: integer; begin for n := 1 to maxarg by 2 do write(length(orbit(n))," "); end; end; a064685(140); (* For definition of function orbit see A064684. *)

Formula

f(n)= n/2 if n is even, 3n+1 if n is odd; stop if n is 1.

Extensions

More terms from Klaus Brockhaus, Oct 13 2001