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 A323424 #11 Jan 17 2019 15:56:21 %S A323424 1,1,2,1,2,2,3,2,2,2,3,2,3,2,3,2,2,2,3,2,2,2,3,2,2,2,4,2,2,2,3,2,2,2, %T A323424 3,2,3,3,3,2,3,2,4,2,3,2,3,2,3,2,3,2,2,2,4,2,2,2,3,2,2,2,3,2,2,2,3,2, %U A323424 3,2,3,2,2,2,3,3,2,2,3,2,2,2,4,2,2,2,3 %N A323424 Number of cycles (mod n) under Collatz map. %C A323424 This sequence is likely to be unbounded. %H A323424 Rémy Sigrist, <a href="/A323424/a323424.png">Illustration for n = 13</a> %H A323424 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A323424 a(n) >= 2 for any n > 4 (as we have at least the cycles (0) and (1, 4, 2)). %e A323424 The initial terms, alongside the corresponding cycles, are: %e A323424 n a(n) cycles %e A323424 -- ---- -------------------- %e A323424 1 1 (0) %e A323424 2 1 (0) %e A323424 3 2 (0), (1) %e A323424 4 1 (0) %e A323424 5 2 (0), (1, 4, 2) %e A323424 6 2 (0), (1, 4, 2) %e A323424 7 3 (0), (1, 4, 2), (3) %e A323424 8 2 (0), (1, 4, 2) %e A323424 9 2 (0), (1, 4, 2) %e A323424 10 2 (0), (1, 4, 2) %e A323424 11 3 (0), (1, 4, 2), (5) %e A323424 12 2 (0), (1, 4, 2) %e A323424 13 3 (0), (1, 4, 2), (3, 10, 5) %e A323424 14 2 (0), (1, 4, 2) %e A323424 15 3 (0), (1, 4, 2), (7) %e A323424 16 2 (0), (1, 4, 2) %e A323424 17 2 (0), (1, 4, 2) %e A323424 18 2 (0), (1, 4, 2) %e A323424 19 3 (0), (1, 4, 2), (9) %e A323424 20 2 (0), (1, 4, 2) %o A323424 (PARI) a(n, f = k -> if (k%2, 3*k+1, k/2)) = { my (c=0, s=0); for (k=0, n-1, if (!bittest(s, k), my (v=0, i=k); while (1, v += 2^i; i = f(i) % n; if (bittest(s, i), break, bittest(v, i), c++; break)); s += v)); return (c) } %Y A323424 See A000374, A023135, A023153, A233521 for similar sequences. %Y A323424 Cf. A006370. %K A323424 nonn %O A323424 1,3 %A A323424 _Rémy Sigrist_, Jan 14 2019