CJam, (削除) 26 (削除ここまで) 27 bytes
ri){mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
EDIT: Forgot n was inclusive.
For fun, this is very similar and also 27 bytes:
ri){_mp2円b_1-,mp0円-,mp&&},p
Explanation
ri e# Take an int as input
){mp}, e# Take the range up and including to the input,
e# including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length
e# is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely
CJam, (削除) 26 (削除ここまで) 27 bytes
ri){mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
EDIT: Forgot n was inclusive.
Explanation
ri e# Take an int as input
){mp}, e# Take the range up and including to the input,
e# including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length
e# is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely
CJam, (削除) 26 (削除ここまで) 27 bytes
ri){mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
EDIT: Forgot n was inclusive.
For fun, this is very similar and also 27 bytes:
ri){_mp2円b_1-,mp0円-,mp&&},p
Explanation
ri e# Take an int as input
){mp}, e# Take the range up and including to the input,
e# including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length
e# is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely
CJam, 26(削除) 26 (削除ここまで) 27 bytes
ri){mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
Try it online! EDIT: Forgot n was inclusive.
Explanation
ri e# Take an int as input
){mp}, e# Take the range up and including to the input, e# including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length
e# is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely
CJam, 26 bytes
ri{mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
Explanation
ri e# Take an int as input
{mp}, e# Take the range up to the input, including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely
CJam, (削除) 26 (削除ここまで) 27 bytes
ri){mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
EDIT: Forgot n was inclusive.
Explanation
ri e# Take an int as input
){mp}, e# Take the range up and including to the input, e# including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length
e# is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely
CJam, 26 bytes
ri{mp},{2b_1-,mp0円-,mp&},p
Straightforward algorithm, will golf further.
Explanation
ri e# Take an int as input
{mp}, e# Take the range up to the input, including only prime numbers
{ e# For each prime...
2b_ e# Convert it to binary and copy it
1-,mp e# Take the top binary number, remove 1's, check if the length is prime
\ e# Swap top elements
0-,mp e# Do the same but remove 0's
& e# And
}, e# Filter out primes for which the above block was false
p e# Print nicely