A347209 Emirps in both base 2 and base 10.
13, 37, 71, 97, 113, 167, 199, 337, 359, 701, 709, 739, 907, 937, 941, 953, 967, 1033, 1091, 1109, 1153, 1181, 1201, 1217, 1229, 1259, 1439, 1471, 1487, 1669, 1733, 1789, 1811, 1933, 1949, 3019, 3067, 3083, 3089, 3121, 3163, 3221, 3299, 3343, 3389, 3433, 3469, 3511, 3527, 3571, 3583, 3643, 3719
Offset: 1
Examples
a(3) = 71 is a term because 71 is prime, its base-10 reversal 17 is a prime other than 71, and its base-2 reversal 113 is a prime other than 71.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
filter:= proc(n) local L,nL,i,r,s; if not isprime(n) then return false fi; L:= convert(n,base,10); nL:= nops(L); r:= add(10^(nL-i)*L[i],i=1..nL); if r=n or not isprime(r) then return false fi; L:= convert(n,base,2); nL:= nops(L); s:=add(2^(nL-i)*L[i],i=1..nL); s <> n and isprime(s) end proc: select(filter, [seq(i,i=3..10000,2)]);
-
Mathematica
Select[Range[4000], (ir = IntegerReverse[#]) != # && PrimeQ[#] && PrimeQ[ir] && (ir2 = IntegerReverse[#, 2]) != # && PrimeQ[ir2] &] (* Amiram Eldar, Aug 23 2021 *) Select[Prime[Range[600]],!PalindromeQ[#]&&FromDigits[Reverse[IntegerDigits[#,2]],2]!=#&&AllTrue[{IntegerReverse[#],FromDigits[Reverse[IntegerDigits[#,2]],2]},PrimeQ]&] (* Harvey P. Dale, Oct 13 2022 *)
-
Python
from sympy import isprime, primerange def ok(p): s, b = str(p), bin(p)[2:] if s == s[::-1] or b == b[::-1]: return False return isprime(int(s[::-1])) and isprime(int(b[::-1], 2)) print(list(filter(ok, primerange(1, 3720)))) # Michael S. Branicky, Aug 24 2021
Comments