A347476 Numbers which give a prime number when 0's and 1's are interchanged in their binary representation.
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
Programs
-
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 *)
-
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
-
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
Extensions
More terms from Michael S. Branicky, Sep 03 2021
Comments