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 A222118 #37 Dec 16 2022 07:05:20 %S A222118 1,1,6,0,0,1,10,0,3,0,0,1,0,0,9,0,0,1,5,0,3,0,0,1,3,0,95,0,0,1,0,0,3, %T A222118 0,0,1,3,0,12,0,0,1,8,0,3,0,0,1,0,0,5,0,0,1,7,0,3,0,0,1,0,0,13,0,0,1, %U A222118 0,0,3,0,0,1,3,0,8,0,0,1,9,0,1,0,0,1,0,0,7 %N A222118 Number of terms in Collatz (3x+1) trajectory of n that did not appear in previous trajectories. %C A222118 For n > 2, n such that a(n) = 0 are termed impure (A134191), while n such that a(n) > 0 are termed pure (A061641). - _T. D. Noe_, Feb 23 2013 %C A222118 From _Robert G. Wilson v_, Feb 25 2017: (Start) %C A222118 For a(n) to be equal to 0, n != 0 (mod 3), %C A222118 For a(n) to be an even positive number, n = {3, 7} (mod 12), %C A222118 For a(n) to be equal to 1, n = {0, 1, 2, 3, 6, 7, 9} (mod 12), %C A222118 For a(n) to be equal to 3, n = {1, 3, 9} (mod 12), %C A222118 For a(n) to be an odd number > 3, n = {3, 7} (mod 12). %C A222118 [Note that the above conditions are necessary but not sufficient. - Editors, Dec 15 2017] %C A222118 (End) %C A222118 a(n) gives the number of new terms in the n-th row of A070165 (see A263716). - _Andrey Zabolotskiy_, Feb 27 2017 %H A222118 T. D. Noe, <a href="/A222118/b222118.txt">Table of n, a(n) for n = 1..10000</a> %H A222118 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A222118 a(n) = A006577(n) - A221956(n) + 1. - _Michel Lagneau_, Feb 23 2013 %e A222118 a(7) = 10, since trajectory of 7 includes 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, which did not appear in earlier trajectories. %t A222118 Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; found = {}; Table[c = Collatz[n]; r = Complement[c, found]; found = Union[found, c]; Length[r], {n, 100}] (* _T. D. Noe_, Feb 23 2013 *) %o A222118 (Python) %o A222118 s = set([1]) %o A222118 print(1) %o A222118 for n in range(2, 100): %o A222118 m, r = n, 0 %o A222118 while m not in s: %o A222118 s.add(m) %o A222118 m = (m//2 if m%2==0 else 3*m+1) %o A222118 r += 1 %o A222118 print(r) %o A222118 # _Andrey Zabolotskiy_, Feb 21 2017 %Y A222118 Cf. A006577, A061641, A070165, A134191, A177729, A221956, A222297, A263716. %K A222118 nonn %O A222118 1,3 %A A222118 _Jayanta Basu_, Feb 23 2013