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.

A179118 Number of Collatz steps to reach 1 starting with 2^n + 1.

This page as a plain text file.
%I A179118 #30 May 20 2021 08:20:02
%S A179118 1,7,5,19,12,26,27,121,122,35,36,156,113,52,53,98,99,100,101,102,72,
%T A179118 166,167,168,169,170,171,247,173,187,188,251,252,178,179,317,243,195,
%U A179118 196,153,154,155,156,400,326,495,496,161,162,331,332,408,471,410,411,337,338,339,340,553
%N A179118 Number of Collatz steps to reach 1 starting with 2^n + 1.
%C A179118 There are many long runs of consecutive terms that increase by 1 (see second conjecture in A277109). For n < 40000, the longest run has 1030 terms starting from a(33237) = 244868 and ending with a(34266) = 245897. - _Dmitry Kamenetsky_, Sep 30 2016
%H A179118 Dmitry Kamenetsky, <a href="/A179118/b179118.txt">Table of n, a(n) for n = 0..9999</a> (terms n = 1...1000 from Mitch Harris)
%H A179118 MathOverflow, <a href="http://mathoverflow.net/questions/51124/collatz-conjecture-for-numbers-of-th-form-2n-1">Introduced on Mathoverflow by Henrik RĂ¼ping</a>
%F A179118 a(n) = A006577(2^n+1) = A006577(A000051(n)).
%F A179118 a(n) = A075486(n) - 1. - _T. D. Noe_, Jan 17 2013
%e A179118 a(1)=7 because the trajectory of 2^1+1=3 is (3,10,5,16,8,4,2,1).
%t A179118 CollatzNext[n_] := If[Mod[n, 2] == 0, n/2, 3 n + 1]; CollatzPath[n_] := CollatzPath[n] = Module[{k = n, l = {}}, While[k != 1, k = CollatzNext[k]; l = Append[l, k]]; l]; Collatz[n_] := Length[CollatzPath[n]]; Table[Collatz[2^n+1],{n,1,50}]
%t A179118 f[n_] := Length@ NestWhileList[If[OddQ@ #, 3 # + 1, #/2] &, 2^n + 1, # > 1 &] - 1; Array[f, 60] (* _Robert G. Wilson v_, Jan 05 2011 *)
%t A179118 Array[-1 + Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, 2^# + 1, # > 1 &] &, 60, 0] (* _Michael De Vlieger_, Nov 25 2018 *)
%o A179118 (Python)
%o A179118 def steps(a):
%o A179118   if a==1:     return 0
%o A179118   elif a%2==0: return 1+steps(a//2)
%o A179118   else:        return 1+steps(a*3+1)
%o A179118 for n in range(60):
%o A179118   print(n, steps((1<<n)+1))
%o A179118 (PARI) nbsteps(n)= s=n; c=0; while(s>1, s=if(s%2, 3*s+1, s/2); c++); c;
%o A179118 a(n) = nbsteps(2^n+1); \\ _Michel Marcus_, Oct 28 2018
%Y A179118 Cf. A000051, A006577, A070976, A074472, A075486, A193688 (starting with 2^n-1), , A179118, A277109.
%K A179118 nonn,easy
%O A179118 0,2
%A A179118 _Mitch Harris_, Jan 04 2011
%E A179118 a(0)=1 prepended by _Alois P. Heinz_, Dec 12 2018