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 A224183 #18 Jan 24 2021 11:16:24 %S A224183 1,1,4,2,4,5,4,3,11,4,6,6,9,4,9,4,17,12,7,4,23,7,18,7,17,10,7,5,10,10, %T A224183 21,5,28,17,13,13,17,8,13,5,17,24,8,8,22,19,16,8,26,17,11,11,16,8,17, %U A224183 6,29,11,11,11,17,22,19,6,37,29,20,17,19,14,19,14,24 %N A224183 Number of halving and tripling steps to reach the last number of the cycle in the Collatz (3x+1) problem for the negative integers (the initial term is not counted). %C A224183 The Collatz problem with negative numbers is as follows: start with any number n = -1, -2, -3, ... If n is even, divide it by 2, otherwise multiply it by 3 and add 1. Do we always reach a last number of each cycle? It is conjectured that the answer is yes. %C A224183 A majority of last numbers of each cycle is -1, but it is possible to obtain also -5, -10, -14, -20, -34,.... %H A224183 Michel Lagneau, <a href="/A224183/b224183.txt">Table of n, a(n) for n = 1..10000</a> %e A224183 a(10) = 4 because the trajectory of -10 is -10 -> -5 -> -14 -> -7 -> -20 -> -10 and -10 is the last term of the cycle, hence 4 iterations. %p A224183 printf(`%d, `,1): for n from -2 by -1 to -100 do:x:=n:lst:={n}:for it from 1 to 100 do:if irem(x,2)=0 then x := x/2: lst:=lst union{x} :else x := 3*x+1: lst:=lst union{x}fi:od:d:=nops(lst): printf(`%d, `,d-1): od: %t A224183 Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, UnsameQ, All]; Table[s = Collatz[-n]; len = Length[s] - 2; If[s[[-1]] == 2, len = len - 1]; len, {n, 1,100}] %Y A224183 Cf. A006577. %K A224183 nonn %O A224183 1,3 %A A224183 _Michel Lagneau_, Apr 01 2013 %E A224183 a(1) changed to 1 by _Pontus von Brömssen_, Jan 24 2021