login
Numbers n for which the number of odd members and the number of even members in the Collatz (3x+1) trajectory are both prime.
1

%I #17 May 10 2021 02:36:31

%S 3,9,10,12,13,22,23,40,42,73,88,90,92,93,114,115,118,119,144,148,149,

%T 152,154,162,163,164,165,166,192,208,212,213,226,227,251,295,318,319,

%U 350,351,576,592,596,597,608,616,618,625,640,642,643,648,650,652,653

%N Numbers n for which the number of odd members and the number of even members in the Collatz (3x+1) trajectory are both prime.

%C Or numbers m such that A078719(m) and A006666(m) are both prime.

%C The distinct pairs of primes in the order of appearance are: (3, 5), (7, 13), (2, 5), (3, 7), (5, 11), (2, 7), (43, 73), (5, 13), (11, 23), (7, 17), (41, 71), (3, 11), (23, 43), (19, 37),...

%H Charles R Greathouse IV, <a href="/A282409/b282409.txt">Table of n, a(n) for n = 1..10000</a>

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

%e 13 is in the sequence because its Collatz trajectory is 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 which contains 3 odd members and 7 even members.

%p nn:=10^6:

%p for n from 1 to 500 do:

%p m:=n:i1:=1:i2:=0:

%p for i from 1 to nn while(m<>1) do:

%p if irem(m,2)=0

%p then

%p m:=m/2:i2:=i2+1:

%p else

%p m:=3*m+1:i1:=i1+1:

%p fi:

%p od:

%p if isprime(i1) and isprime(i2)

%p then

%p printf(`%d, `,n):

%p else

%p fi:od:

%o (PARI) is(n)=my(e,o=1); while(n>1, n=if(n%2, o++; 3*n+1, e++; n/2)); isprime(e) && isprime(o) \\ _Charles R Greathouse IV_, Feb 14 2017

%o (Python)

%o from sympy import isprime

%o def a(n):

%o l=[n]

%o while True:

%o if n%2==0: n//=2

%o else: n = 3*n + 1

%o l.append(n)

%o if n<2: break

%o o=list(filter(lambda i: i%2==1, l))

%o e=list(filter(lambda i: i%2==0, l))

%o return [o, e]

%o print([n for n in range(2, 1001) if isprime(len(a(n)[0])) and isprime(len(a(n)[1]))]) # _Indranil Ghosh_, Apr 14 2017

%Y Cf. A078719, A006666, A006667.

%K nonn

%O 1,1

%A _Michel Lagneau_, Feb 14 2017