A346408 Primes whose bitwise XOR of decimal digits is a prime.
2, 3, 5, 7, 13, 29, 31, 41, 43, 47, 61, 83, 103, 113, 131, 137, 139, 151, 157, 173, 193, 211, 223, 227, 233, 241, 263, 269, 277, 281, 311, 317, 337, 353, 367, 373, 379, 389, 397, 401, 409, 421, 443, 461, 467, 487, 557, 571, 577, 599, 601, 641, 647, 673, 683
Offset: 1
Examples
421 is a term because it is a prime whose bitwise XOR of digits is 7 which is also a prime.
Links
- Wikipedia, Bitwise operation
Programs
-
Maple
b:= l-> `if`(l=[], 0, Bits[Xor](l[1], b(subsop(1=[][], l)))): q:= n-> isprime(b(convert(n, base, 10))): select(q, [ithprime(i)$i=1..160])[]; # Alois P. Heinz, Jul 21 2021
-
Mathematica
Select[Range[1000], PrimeQ[#] && PrimeQ[BitXor @@ IntegerDigits[#]] &] (* Amiram Eldar, Jul 21 2021 *)
-
Sage
def XOR(a, b): return a ^^ b [n for n in (0..100) if (n in Primes() and reduce(XOR, map(lambda x: int(x), str(n))) in Primes())]
Comments