login
A241059
Antipalindromic primes: primes with an even number of digits such that the digits in the first half of the prime differ from the corresponding digits of the second half.
1
13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 1013, 1019, 1033, 1039, 1049, 1063, 1069, 1087, 1093, 1097, 1103, 1109, 1123, 1129, 1153, 1163, 1187, 1193, 1213, 1217, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1297, 1303, 1307
OFFSET
1,1
LINKS
MAPLE
filter:= proc(n) local L, LR;
L:= convert(n, base, 10);
if nops(L)::odd
then return false
fi;
L:= ListTools:-Reverse(L) - L;
not has(L, 0);
end;
Primes:= [seq(op(select(isprime, [$10^(2*n-1) ... 10^(2*n)-1])), n=1..3)]:
A241059:= select(filter, Primes); # Robert Israel, Apr 17 2014
PROG
(PARI) for(n=1, 1307, s=#Str(n); if(!bitand(s, 1)&&isprime(n), t=0; v=Vec(Str(n)); for(k=1, s/2, if(v[k]==v[s+1-k], break, t++)); if(t==s/2, print1(n, ", "))));
(Python)
from sympy import isprime
def ok(n):
s = str(n)
return not len(s)&1 and all(s[i] != s[-1-i] for i in range(len(s)//2)) and isprime(n)
print([k for k in range(2000) if ok(k)]) # Michael S. Branicky, Jun 17 2024
CROSSREFS
Sequence in context: A334391 A334321 A034845 * A040136 A049482 A099651
KEYWORD
nonn,base
AUTHOR
STATUS
approved