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 A335870 #9 Jul 02 2020 02:03:36 %S A335870 1,3,3,6,3,3,6,15,3,18,6,12,9,9,15,15,3,12,18,18,6,6,15,15,9,21,9,111, %T A335870 18,18,18,105,3,24,12,12,21,21,21,33,6,108,6,27,15,15,15,102,9,24,24, %U A335870 24,9,9,111,111,18,30,18,30,18,18,105,105,6,27,27,27,12 %N A335870 a(n) is the least k > 0 such that T^k(n) = T^(2*k)(n) (where T^k denotes the k-th iterate of A006370, the Collatz map); a(n) = -1 if no such k exists. %C A335870 If the Collatz conjecture is true, then a(n) > 0 for all n >= 0. %H A335870 Rémy Sigrist, <a href="/A335870/b335870.txt">Table of n, a(n) for n = 0..10000</a> %H A335870 Wikipedia, <a href="https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_Tortoise_and_Hare">Floyd's Tortoise and Hare</a> %H A335870 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %e A335870 For n = 3 we have: %e A335870 k T^k(3) T^(2*k)(3) %e A335870 - ------ ---------- %e A335870 1 10 5 %e A335870 2 5 8 %e A335870 3 16 2 %e A335870 4 8 4 %e A335870 5 4 1 %e A335870 6 2 2 %e A335870 so a(3) = 6. %o A335870 (PARI) a(n, T=x->if (x%2, 3*x+1, x/2)) = my (x1=n, x2=n); for (k=1, oo, x1=T(x1); x2=T(T(x2)); if (x1==x2, return (k))) %Y A335870 Cf. A006370, A139399. %K A335870 nonn %O A335870 0,2 %A A335870 _Rémy Sigrist_, Jun 28 2020