OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
EXAMPLE
7 is a term since its binary representation has 3 bits, a prime.
67 is a term since its binary representation has 7 bits, a prime.
MATHEMATICA
Select[Table[j, {j, 1, 1200}], (PrimeQ[#] && PrimeQ[Length@IntegerDigits[#, 2]]) &]
Select[Prime[Range[200]], PrimeQ[Length[IntegerDigits[#, 2]]]&] (* Harvey P. Dale, Jun 04 2019 *)
PROG
(PARI) isok(n) = isprime(n) && isprime(#binary(n)); \\ Michel Marcus, Apr 30 2016
(PARI) forprime(d=2, 13, forprime(p=2^(d-1), 2^d, print1(p", "))) \\ Charles R Greathouse IV, May 01 2016
(Python)
from itertools import islice
from sympy import isprime, nextprime
def agen(): # generator of terms
d = 3
yield from [2, 3]
while True:
yield from (i for i in range(2**(d-1)+1, 2**d, 2) if isprime(i))
d = nextprime(d)
print(list(islice(agen(), 50))) # Michael S. Branicky, Dec 27 2023
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Andres Cicuttin, Apr 30 2016
STATUS
approved