A282409 Numbers n for which the number of odd members and the number of even members in the Collatz (3x+1) trajectory are both prime.
3, 9, 10, 12, 13, 22, 23, 40, 42, 73, 88, 90, 92, 93, 114, 115, 118, 119, 144, 148, 149, 152, 154, 162, 163, 164, 165, 166, 192, 208, 212, 213, 226, 227, 251, 295, 318, 319, 350, 351, 576, 592, 596, 597, 608, 616, 618, 625, 640, 642, 643, 648, 650, 652, 653
Offset: 1
Keywords
Examples
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.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- Index entries for sequences related to 3x+1 (or Collatz) problem
Programs
-
Maple
nn:=10^6: for n from 1 to 500 do: m:=n:i1:=1:i2:=0: for i from 1 to nn while(m<>1) do: if irem(m,2)=0 then m:=m/2:i2:=i2+1: else m:=3*m+1:i1:=i1+1: fi: od: if isprime(i1) and isprime(i2) then printf(`%d, `,n): else fi:od:
-
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
-
Python
from sympy import isprime def a(n): l=[n] while True: if n%2==0: n//=2 else: n = 3*n + 1 l.append(n) if n<2: break o=list(filter(lambda i: i%2==1, l)) e=list(filter(lambda i: i%2==0, l)) return [o, e] 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
Comments