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 A074473 #32 Aug 15 2025 08:29:57 %S A074473 1,2,7,2,4,2,12,2,4,2,9,2,4,2,12,2,4,2,7,2,4,2,9,2,4,2,97,2,4,2,92,2, %T A074473 4,2,7,2,4,2,14,2,4,2,9,2,4,2,89,2,4,2,7,2,4,2,9,2,4,2,12,2,4,2,89,2, %U A074473 4,2,7,2,4,2,84,2,4,2,9,2,4,2,14,2,4,2,7,2,4,2,9,2,4,2,74,2,4,2,14,2,4,2,7 %N A074473 Dropping time for the 3x+1 problem: for n >= 2, number of iteration that first becomes smaller than the initial value if Collatz-function (A006370) is iterated starting at n; a(1)=1 by convention. %C A074473 Here we call the starting value iteration number 1, although usually the count is started at 0, which would subtract 1 from the values for n >= 2 - see A060445, A102419. %H A074473 N. J. A. Sloane, <a href="/A074473/b074473.txt">Table of n, a(n) for n = 1..10000</a> %e A074473 n=2k: then a(2k)=2 because the second iterate is k<n=2k, the first iterate below 2k; n=4k+1, k>1: the list = {4k+1, 12k+4, 6k+2, 3k+1, ...} i.e. the 4th term is always the first below initial value, so a(4k+1)=4; %e A074473 n=15: the list={15, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1} and 12th term is first sinks below iv=15, so a(15)=12; relatively larger values occur at n=4k+3. %e A074473 n=3: the list is {3, 10, 5, 16, 8, 4, 2, 1, ..}, the 7th term is 2, which is the first smaller than 3, so a(3)=7. %t A074473 nextx[x_Integer] := If[OddQ@x, 3x + 1, x/2]; f[1] = 1; f[n_] := Length@ NestWhileList[nextx, n, # >= n &]; Array[f, 83] (* Bobby R. Treat (drbob(at)bigfoot.com), Sep 16 2006 *) %o A074473 (Python) %o A074473 def a(n): %o A074473 if n<3: return n %o A074473 N=n %o A074473 x=1 %o A074473 while True: %o A074473 if n%2==0: n/=2 %o A074473 else: n = 3*n + 1 %o A074473 x+=1 %o A074473 if n<N: return x %o A074473 [a(n) for n in range(1, 101)] # _Indranil Ghosh_, Apr 15 2017 %o A074473 (PARI) A074473(n) = if (n<3, n, my(N=n, x=1); while (1, if (n%2==0, n/=2, n = 3*n + 1); x++; if (n<N, return(x)););); \\ _Michel Marcus_, Aug 15 2025 %Y A074473 Cf. A006370, A075476, A075477, A075478, A075479, A075480, A075481, A075482, A075483, A060445, A060412, A217934. %Y A074473 Equals A102419(n)+1. %K A074473 nonn %O A074473 1,2 %A A074473 _Labos Elemer_, Sep 19 2002 %E A074473 Edited by _N. J. A. Sloane_, Sep 15 2006