OFFSET
1,1
COMMENTS
Base-2 analog of A095179.
If k is a term, then 2*k is a term too. - Michel Marcus, Apr 19 2020
LINKS
Michel Marcus, Table of n, a(n) for n = 1..1000
EXAMPLE
3, 5 and 7 are in the sequence because their binary reversal, equal to themselves, is prime.
a(3)=6 is in the sequence, because 6=110[2] (written in base 2), whose reversal 011[2]=3 is prime.
a(5)=11 is in the sequence, because 11=1011[2] (written in base 2), whose reversal 1101[2]=13 is prime.
MATHEMATICA
Select[Range[170], PrimeQ[FromDigits[Reverse[IntegerDigits[#, 2]], 2]] &] (* Alonso del Arte, Jan 13 2012 *)
PROG
(PARI) for(n=1, 1e2, isprime((t=binary(n))*vector(#t, i, 1<<i)~\2) & print1(n", "))
(Python)
from sympy import isprime
def ok(n): return isprime(int(bin(n)[2:][::-1], 2))
print(list(filter(ok, range(1, 122)))) # Michael S. Branicky, Sep 06 2021
(Python) # alternate program constructing terms directly from primes
from sympy import isprime, primerange
def auptobits(maxbits):
alst = []
for p in primerange(3, 1<<maxbits):
b = bin(p)[2:]; br = b[::-1]; t = int(br, 2)
alst.extend(t<<i for i in range(maxbits-len(br)+1))
return sorted(alst)
print(auptobits(7)) # Michael S. Branicky, Oct 29 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
M. F. Hasler, Jan 13 2012
STATUS
approved