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.

A221956 Number of values in the Collatz (3x+1) trajectory starting at n that are also present in the trajectory for some k < n.

Original entry on oeis.org

0, 1, 2, 3, 6, 8, 7, 4, 17, 7, 15, 9, 10, 18, 9, 5, 13, 20, 16, 8, 5, 16, 16, 10, 21, 11, 17, 19, 19, 18, 107, 6, 24, 14, 14, 21, 19, 22, 23, 9, 110, 8, 22, 17, 14, 17, 105, 11, 25, 25, 20, 12, 12, 112, 106, 20, 30, 20, 33, 19, 20, 108, 95, 7, 28, 27, 28, 15, 12
Offset: 1

Views

Author

Michel Lagneau, Feb 23 2013

Keywords

Examples

			a(15) = 9 because the Collatz trajectory starting at 15 is (15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1), which has 9 values, namely, 40, 20, 10, 5, 16, 8, 4, 2, and 1, in common with the trajectory for at least one k < 15.
		

Crossrefs

Programs

  • Maple
    lst1:={1}: L:={1}:for n from 2 to 200 do: x := n :lst:={n}:while x > 1 do if type(x, 'even') then x := x/2:lst:=lst union {x}:  else x := 3*x+1 : lst:=lst union {x}: end if; end do;lst2:=L intersect lst:n2:=nops(lst2 ): printf(`%d, `,n2): L:=L union lst:od:
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; found = {}; Table[c = Collatz[n]; r = Intersection[c, found]; found = Union[found, c]; Length[r], {n, 100}] (* T. D. Noe, Feb 23 2013 *)