OFFSET
1,1
COMMENTS
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
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:
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 14 2017
STATUS
approved