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.

A070975 Number of steps to reach 1 in `3x+1' (or Collatz) problem starting with prime(n).

This page as a plain text file.
%I A070975 #29 Apr 30 2021 08:02:08
%S A070975 1,7,5,16,14,9,12,20,15,18,106,21,109,29,104,11,32,19,27,102,115,35,
%T A070975 110,30,118,25,87,100,113,12,46,28,90,41,23,15,36,23,67,31,31,18,44,
%U A070975 119,26,119,39,70,13,34,83,52,21,65,122,78,29,42,16,42,60,117,37,86,130,37,24
%N A070975 Number of steps to reach 1 in `3x+1' (or Collatz) problem starting with prime(n).
%H A070975 T. D. Noe, <a href="/A070975/b070975.txt">Table of n, a(n) for n=1..10000</a>
%F A070975 a(n) = A006577(prime(n)). - _Michel Marcus_, Sep 07 2014
%t A070975 ns[n_]:=Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&]]-1; ns/@ Prime[Range[70]] (* _Harvey P. Dale_, Jul 29 2014 *)
%o A070975 (PARI) for(n=2,100,s=prime(n); t=0; while(s!=1,t++; if(s%2==0,s=s/2,s=3*s+1); if(s==1,print1(t,","); ); ))
%o A070975 (Python)
%o A070975 from sympy import prime
%o A070975 def a006577(n):
%o A070975     if n==1: return 0
%o A070975     x=0
%o A070975     while True:
%o A070975         if n%2==0: n//=2
%o A070975         else: n = 3*n + 1
%o A070975         x+=1
%o A070975         if n<2: break
%o A070975     return x
%o A070975 def a(n): return a006577(prime(n))
%o A070975 print([a(n) for n in range(1, 101)]) # _Indranil Ghosh_, Jun 05 2017
%Y A070975 Cf. A006577.
%K A070975 easy,nonn
%O A070975 1,2
%A A070975 _Benoit Cloitre_, May 17 2002