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 A263716 #41 Dec 15 2022 05:23:45 %S A263716 1,2,3,10,5,16,8,4,6,7,22,11,34,17,52,26,13,40,20,9,28,14,12,15,46,23, %T A263716 70,35,106,53,160,80,18,19,58,29,88,44,21,64,32,24,25,76,38,27,82,41, %U A263716 124,62,31,94,47,142,71,214,107,322,161,484,242,121,364,182 %N A263716 Irregular triangle read by rows: numbers in the Collatz conjecture in the order of their first appearance. %C A263716 This is the irregular triangle read by rows giving trajectory of n in the Collatz problem, flattened and with all the repeated terms deleted. %C A263716 This sequence goes to infinity as n gets larger. On the Collatz conjecture this sequence is a permutation of the positive integers. [Corrected by _Charles R Greathouse IV_, Jul 29 2016] %H A263716 Daniel Suteu, <a href="/A263716/b263716.txt">Table of n, a(n) for n = 0..19999</a> %H A263716 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A263716 row(n) = { %F A263716 if seen[n]: stop %F A263716 else: write(n) and do: %F A263716 | n is one: stop %F A263716 | n is odd: n <- 3*n+1 %F A263716 | n is even: n <- n/2 %F A263716 } %e A263716 Triangle begins: %e A263716 1; %e A263716 2; %e A263716 3, 10, 5, 16, 8, 4; %e A263716 ... %e A263716 The Collatz trajectories for the first five positive integers are {1}, {2, 1}, {3, 10, 5, 16, 8, 4, 2, 1}, {4, 2, 1}, {5, 16, 8, 4, 2, 1}. %e A263716 From {2, 1} we delete 1 because it has already occurred. From {3, 10, 5, ..., 4, 2, 1} we delete {2, 1} because both numbers have already occurred. We completely get rid of {4, 2, 1} because it has already occurred as the tail end of {3, 10, 5, ...}, and we also completely get rid of {5, 16, 8, ...} for the same reason. %e A263716 This leaves us with {1}, {2}, {3, 10, 5, 16, 8, 4}, thus accounting for the first eight terms of this sequence. %t A263716 collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; DeleteDuplicates[Flatten[Table[collatz[n], {n, 20}]]] (* _Alonso del Arte_, Oct 24 2015 *) %o A263716 (Sidef) %o A263716 func collatz(n) is cached { # automatically memoized function %o A263716 say n; # prints the first unseen numbers %o A263716 n.is_one ? 0 %o A263716 : (n.is_even ? collatz(n/2) %o A263716 : collatz(3*n + 1)); %o A263716 } %o A263716 range(1, Math.inf).each { |i| collatz(i) } %Y A263716 Cf. A006577, A070165, A222118 (row lengths). %Y A263716 Cf. A347265 (essentially the same). %K A263716 nonn,tabf,easy,nice %O A263716 0,2 %A A263716 _Daniel Suteu_, Oct 24 2015