login
A347476
Numbers which give a prime number when 0's and 1's are interchanged in their binary representation.
1
4, 5, 8, 10, 12, 13, 18, 20, 24, 26, 28, 29, 32, 34, 40, 44, 46, 50, 52, 56, 58, 60, 61, 66, 68, 74, 80, 84, 86, 90, 96, 98, 104, 108, 110, 114, 116, 120, 122, 124, 125, 128, 142, 146, 148, 152, 154, 158, 166, 172, 176, 182, 184, 188, 194, 196, 202, 208, 212
OFFSET
1,1
COMMENTS
Subsequence of primes is A050415 and then, the obtained prime is always 2. We have: prime p = 2^k-3, k>=3 -> p = 11...1101_2 with a string of (k-2) digits 1 before '01' ==> 00...0010_2 = 10_2 -> 2_10. - Bernard Schott, Oct 21 2021
MAPLE
q:= n-> isprime(Bits[Nand](n$2)):
select(q, [$1..300])[]; # Alois P. Heinz, Sep 03 2021
MATHEMATICA
Select[Range[200], PrimeQ @ FromDigits[IntegerDigits[#, 2] /. {0 -> 1, 1 -> 0}, 2] &] (* Amiram Eldar, Sep 03 2021 *)
PROG
(Python)
from sympy import isprime
def comp(s): z, o = ord('0'), ord('1'); return s.translate({z:o, o:z})
def ok(n): return isprime(int(comp(bin(n)[2:]), 2))
print(list(filter(ok, range(214)))) # Michael S. Branicky, Sep 03 2021
(PARI) isok(m) = isprime(fromdigits(apply(x->1-x, binary(m)), 2)); \\ Michel Marcus, Sep 03 2021
(PARI) is(n) = isprime(1<<(logint(n, 2) + 1) - n - 1) \\ David A. Corneth, Sep 03 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Srijan Suryansh, Sep 03 2021
EXTENSIONS
More terms from Michael S. Branicky, Sep 03 2021
STATUS
approved