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 A337150 #28 Oct 06 2021 07:56:16 %S A337150 0,1,7,2,5,8,16,3,19,6,14,9,17,4,12,20,15,10,23,111,18,106,26,13,21, %T A337150 34,109,29,104,11,24,112,32,107,27,102,22,115,35,110,30,92,105,118,25, %U A337150 87,38,100,113,69,33,95,46,108,121,28,41,90,103,116,36,85,54 %N A337150 Nonnegative integers in the order in which they appear first in A006577. %C A337150 This is A006577 with duplicates removed. %C A337150 This is a permutation of the nonnegative integers. %H A337150 Alois P. Heinz, <a href="/A337150/b337150.txt">Table of n, a(n) for n = 1..1000</a> %H A337150 Wikipedia, <a href="https://en.wikipedia.org/wiki/Collatz_conjecture">Collatz Conjecture</a> %H A337150 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the nonnegative integers</a> %H A337150 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A337150 a(n) = A006577(A337149(n)). %F A337150 a(n) = A006577(n) for 1 <= n <= 12. %p A337150 collatz:= proc(n) option remember; `if`(n=1, 0, %p A337150 1 + collatz(`if`(n::even, n/2, 3*n+1))) %p A337150 end: %p A337150 b:= proc() 0 end: %p A337150 g:= proc(n) option remember; local t; %p A337150 `if`(n=1, 0, g(n-1)); %p A337150 t:= collatz(n); b(t):= b(t)+1 %p A337150 end: %p A337150 h:= proc(n) option remember; local k; for k %p A337150 from 1+h(n-1) while g(k)>1 do od; k %p A337150 end: h(0):=0: %p A337150 a:= n-> collatz(h(n)): %p A337150 seq(a(n), n=1..100); %t A337150 collatz[n_] := collatz[n] = If[n==1, 0, %t A337150 1 + collatz[If[EvenQ[n], n/2, 3n+1]]]; %t A337150 b[_] = 0; %t A337150 g[n_] := g[n] = Module[{t}, If[n==1, 0, g[n-1]]; %t A337150 t = collatz[n]; b[t] = b[t]+1]; %t A337150 h[n_] := h[n] = Module[{k}, For[k = 1+h[n-1], %t A337150 g[k]>1, k++]; k]; h[0] = 0; %t A337150 a[n_] := a[n] = collatz[h[n]]; %t A337150 Array[a, 100] (* _Jean-François Alcover_, Jan 30 2021, after _Alois P. Heinz_ *) %Y A337150 Cf. A006577, A337149. %K A337150 nonn,look %O A337150 1,3 %A A337150 _Alois P. Heinz_, Jan 27 2021