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.

A288023 Number of steps to reach 1 in the Collatz 3x+1 problem starting with the n-th triangular number, or -1 if 1 is never reached.

This page as a plain text file.
%I A288023 #31 Jun 22 2025 15:18:07
%S A288023 0,7,8,6,17,7,18,21,16,112,27,35,92,38,20,15,36,124,106,39,127,109,16,
%T A288023 16,24,81,107,40,27,35,110,30,43,74,38,113,170,46,121,28,103,116,36,
%U A288023 98,124,137,18,119,132,83,26,127,26,47,34,122,91,148,117,130,37,37,112,32,76,94,58,120,120,89,133,53,115,66
%N A288023 Number of steps to reach 1 in the Collatz 3x+1 problem starting with the n-th triangular number, or -1 if 1 is never reached.
%H A288023 Ryan Pythagoras Newton Critchlow, <a href="/A288023/b288023.txt">Table of n, a(n) for n = 1..10000</a>
%F A288023 a(n) = A006577(A000217(n)). - _Omar E. Pol_, Jun 04 2017
%e A288023 For n = 2, the 2nd triangular number is 3, which takes 7 steps to reach 1 in the Collatz (3x+1) problem: (10, 5, 16, 8, 4, 2, 1).
%t A288023 Table[Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&]]-1,{n,Accumulate[ Range[80]]}] (* _Harvey P. Dale_, Aug 17 2017 *)
%o A288023 (Python)
%o A288023 num = 1
%o A288023 def triangleN(x):
%o A288023     return x*(x+1)/2
%o A288023 def stepCount(x):
%o A288023     x = int(x)
%o A288023     steps = 0
%o A288023     while True:
%o A288023         if x == 1:
%o A288023             break
%o A288023         elif x % 2 == 0:
%o A288023             x = x/2
%o A288023             steps += 1
%o A288023         else:
%o A288023             x = x*3 + 1
%o A288023             steps += 1
%o A288023     return steps
%o A288023 while True:
%o A288023     print(stepCount(triangleN(num)))
%o A288023     num += 1
%Y A288023 Cf. A000217, A006577, A070975.
%K A288023 nonn
%O A288023 1,2
%A A288023 _Ryan Pythagoras Newton Critchlow_, Jun 04 2017