cp's OEIS Frontend

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.

A139399 Number of steps to reach a cycle in Collatz problem.

This page as a plain text file.
%I A139399 #22 Feb 16 2025 08:33:08
%S A139399 0,0,5,0,3,6,14,1,17,4,12,7,7,15,15,2,10,18,18,5,5,13,13,8,21,8,109,
%T A139399 16,16,16,104,3,24,11,11,19,19,19,32,6,107,6,27,14,14,14,102,9,22,22,
%U A139399 22,9,9,110,110,17,30,17,30,17,17,105,105,4,25,25,25,12,12,12,100,20,113,20
%N A139399 Number of steps to reach a cycle in Collatz problem.
%C A139399 a(1)=a(2)=a(4)=0 as A006370(A006370(A006370(x)))=x for x=1,2,4 [corrected by _Rémy Sigrist_, Jun 28 2020];
%C A139399 a(n) = A006577(n) - 2 for n > 2 (if the conjecture holds).
%C A139399 For n>2: let L = a(n) mod 3, then A006460(n) = if L=0 then 4 else L. - _Reinhard Zumkeller_, Nov 17 2013
%H A139399 Reinhard Zumkeller, <a href="/A139399/b139399.txt">Table of n, a(n) for n = 1..10000</a>
%H A139399 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>
%H A139399 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%t A139399 f[n_] := If[EvenQ[n], n/2, 3 n + 1];
%t A139399 a[n_] := If[n<3, 0, Length[NestWhileList[f, n, {#1, #2, #3} != {4, 2, 1}&, 3]] - 3];
%t A139399 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Aug 08 2022 *)
%o A139399 (Haskell)
%o A139399 a139399 = f 0 where
%o A139399    f k x = if x `elem` [1,2,4] then k else f (k + 1) (a006370 x)
%o A139399 -- _Reinhard Zumkeller_, Nov 17 2013
%Y A139399 Essentially the same sequence as A112695.
%Y A139399 Cf. A006370, A006460.
%K A139399 nonn
%O A139399 1,3
%A A139399 _Reinhard Zumkeller_, Apr 18 2008