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.
%I A219696 #45 Feb 16 2025 08:33:18 %S A219696 1,2,4,8,10,14,16,20,22,26,40,44,52,106,184,206,244,274,322,526,650, %T A219696 668,790,866,976,1154,1300,1438,1732,1780,1822,2308,2734,3238,7288 %N A219696 Numbers k such that the trajectory of 3k + 1 under the '3x + 1' map reaches k. %C A219696 This sequence seems complete; there are no other terms <= 10^9. - _T. D. Noe_, Dec 03 2012 %C A219696 If the 3x+1 step is replaced with (3x+1)/2, the sequence becomes {1, 2, 4, 8, 10, 14, 20, 22, 26, 40, 44, 206, 244, 650, 668, 866, 1154, 1822, 2308, ...}. - _Robert G. Wilson v_, Jan 13 2015 %C A219696 From _Andrew Slattery_, Aug 03 2023: (Start) %C A219696 For most terms k, the trajectory of 3k + 1 reaches 310 or the trajectory of 310 reaches k. %C A219696 For the rest of the terms k, the trajectory of 3k + 1 reaches 22 or the trajectory of 22 reaches k. %C A219696 With the exception of k = 1, k is reached after S steps, %C A219696 where S = c*8 + d*13 + e*44 + f*75, with c, d, e and f in {0, 1, 2}; in particular, S is in {8, 13, 8+8, 8+13, 13+13, 44, 75, 44+44, 75+13+13, 75+44, 75+75}. (End) %H A219696 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a> %H A219696 Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a> %H A219696 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %e A219696 For k = 4, the Collatz trajectory of 3k + 1 is (13, 40, 20, 10, 5, 16, 8, 4, 2, 1), which includes 4; thus, 4 is in the sequence. %e A219696 For k = 5, the Collatz trajectory of 3k + 1 is (16, 8, 4, 2, 1), which does not include 5; thus, 5 is not in the sequence. %t A219696 Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Select[Range[10000], MemberQ[Collatz[3 # + 1], #] &] (* _T. D. Noe_, Dec 03 2012 *) %o A219696 (Haskell) %o A219696 a219696 n = a219696_list !! (n-1) %o A219696 a219696_list = filter (\x -> collatz'' x == x) [1..] where %o A219696 collatz'' x = until (`elem` [1, x]) a006370 (3 * x + 1) %o A219696 -- _Reinhard Zumkeller_, Aug 11 2014 %o A219696 (Python) %o A219696 def ok(n): %o A219696 if n==1: return [1] %o A219696 N=3*n + 1 %o A219696 l=[N, ] %o A219696 while True: %o A219696 if N%2==1: N = 3*N + 1 %o A219696 else: N/=2 %o A219696 l+=[N, ] %o A219696 if N<2: break %o A219696 if n in l: return 1 %o A219696 return 0 # _Indranil Ghosh_, Apr 22 2017 %o A219696 (PARI) a006370(n) = if(n%2==0, n/2, 3*n+1) %o A219696 is(n) = my(x=3*n+1); while(1, x=a006370(x); if(x==n, return(1), if(x==1, return(0)))) \\ _Felix Fröhlich_, Jun 10 2021 %Y A219696 Cf. A014682, A070991, A006370, A070165. %K A219696 nonn,nice,more %O A219696 1,2 %A A219696 _Robert C. Lyons_, Nov 25 2012 %E A219696 Initial 1 from Clark R. Lyons, Dec 02 2012