login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A078350 Number of primes in {n, f(n), f(f(n)), ..., 1}, where f is the Collatz function defined by f(x) = x/2 if x is even; f(x) = 3x + 1 if x is odd. 14

%I #48 Oct 15 2018 14:07:29

%S 0,1,3,1,2,3,6,1,6,2,5,3,3,6,4,1,4,6,7,2,1,5,4,3,7,3,25,6,6,4,24,1,7,

%T 4,3,6,7,7,11,2,25,1,8,5,4,4,23,3,7,7,6,3,3,25,24,6,8,6,11,4,5,24,20,

%U 1,7,7,9,4,3,3,22,6,25,7,2,7,6,11,11,2,5,25,24,1,1,8,9,5,10,4,20,4,3,23,20

%N Number of primes in {n, f(n), f(f(n)), ..., 1}, where f is the Collatz function defined by f(x) = x/2 if x is even; f(x) = 3x + 1 if x is odd.

%C Number of primes in the trajectory of n under the 3x+1 map (i.e., the number of primes until the trajectory reaches 1, including 2 once). - _Benoit Cloitre_, Dec 23 2002

%C a(A196871(n)) = 0. - _Reinhard Zumkeller_, Oct 08 2011

%C a(A181921(n)) = n and a(m) <> n for m < A181921(n). - _Reinhard Zumkeller_, Apr 03 2012

%H T. D. Noe, <a href="/A078350/b078350.txt">Table of n, a(n) for n = 1..10000</a>

%H J. C. Lagarias, <a href="http://www.cecm.sfu.ca/organics/papers/lagarias/paper/html/paper.html">The 3x+1 problem and its generalizations</a>, Amer. Math. Monthly, 92 (1985), 3-23.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a>

%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>

%F a(n) = A055509(n) + 1 for n > 1.

%F a(n) = 1 when n > 1 is in A000079, i.e., a power of 2. - _Benoit Cloitre_, Dec 20 2017

%e 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1; in this trajectory 3, 5, 2 are primes hence a(3) = 3. - _Benoit Cloitre_, Dec 23 2002

%e The finite sequence n, f(n), f(f(n)), ..., 1 for n = 12 is 12, 6, 3, 10, 5, 16, 8, 4, 2, 1, which has three prime terms. Hence a(12) = 3.

%t f[n_] := n/2 /; Mod[n, 2] == 0 f[n_] := 3 n + 1 /; Mod[n, 2] == 1 g[n_] := Module[{i, p}, i = n; p = 0; While[i > 1, If[PrimeQ[i], p = p + 1]; i = f[i]]; p]; Table[g[n], {n, 1, 100}]

%t Table[Count[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&],_?PrimeQ],{n,100}] (* _Harvey P. Dale_, Aug 29 2012 *)

%o (PARI) for(n=2,500,s=n; t=0; while(s!=1,if(isprime(s)==1,t=t+1,t=t); if(s%2==0,s=s/2,s=(3*s+1)); if(s==1,print1(t,","); ); )) \\ _Benoit Cloitre_, Dec 23 2002

%o (PARI) a(n)=my(s=isprime(n));while(n>1,if(n%2,n=(3*n+1)/2,n/=2);s+=isprime(n));s \\ _Charles R Greathouse IV_, Apr 28 2015

%o (PARI) A078350(n,c=n>1)={while(1<n>>=valuation(n,2), isprime(n)&&c++; n=n*3+1);c} \\ _M. F. Hasler_, Dec 05 2017

%o (Haskell) a078350 n = sum $ map a010051 $ takeWhile (> 1) $ iterate a006370 n -- _Reinhard Zumkeller_, Oct 08 2011

%Y Cf. A064684, A006370, A010051.

%K nonn,nice

%O 1,3

%A _Joseph L. Pe_, Dec 23 2002

%E Edited by _N. J. A. Sloane_, Jan 17 2009 at the suggestion of _R. J. Mathar_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 04:56 EDT 2024. Contains 371767 sequences. (Running on oeis4.)