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 A187831 #20 Feb 16 2022 22:28:26 %S A187831 1,2,3,6,5,6,12,9,9,18,11,14,24,14,18,30,17,18,36,25,22,42,25,27,48, %T A187831 33,28,54,36,33,60,41,42,66,36,41,72,43,39,78,41,54,84,57,50,90,47,54, %U A187831 96,57,66,102,56,54,108,73,57,114,59,78,120,62,82,126,75 %N A187831 Smallest number m > n such that n occurs in Collatz trajectory starting with m; a(0) = 1 by convention. %C A187831 A070165(a(n),k) = n for some k with 1 <= k <= A006577(a(n)). %H A187831 Reinhard Zumkeller, <a href="/A187831/b187831.txt">Table of n, a(n) for n = 0..10000</a> %H A187831 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %e A187831 n = 10: row 11 of A070165 = [11,34,17,52,26,13,40,20,10,5,16,8,4,2,1], %e A187831 therefore A070165(11,9) = 10 and a(10) = 11; %e A187831 n = 11: rows 12 and 13 of A070165 don't contain 11, but 14 does: %e A187831 row 12: [12,6,3,10,5,16,8,4,2,1], %e A187831 row 13: [13,40,20,10,5,16,8,4,2,1], %e A187831 row 14: [14,7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1], %e A187831 therefore A070165(14,4) = 11: a(11) = 14. %t A187831 mcollQ[n_,k_]:=MemberQ[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],k]==True; Prepend[Table[i=n+1; While[!mcollQ[i,n],i++]; i,{n,64}],1] (* _Jayanta Basu_, May 27 2013 *) %t A187831 Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Join[{1}, Table[k = n + 1; While[! MemberQ[Collatz[k], n], k++]; k, {n, 100}]] (* _T. D. Noe_, May 28 2013 *) %o A187831 (Haskell) %o A187831 import Data.List (find) %o A187831 import Data.Maybe (fromJust) %o A187831 a187831 0 = 1 %o A187831 a187831 n = head $ fromJust $ %o A187831 find (n `elem`) $ drop (fromIntegral n) a070165_tabf %Y A187831 Cf. A177729, A061641. %Y A187831 Cf. A225840. %K A187831 nonn %O A187831 0,2 %A A187831 _Reinhard Zumkeller_, Jan 04 2013