OFFSET
1,1
COMMENTS
Includes all primes p from 1.8 * 10^d to 2 * 10^d such that p - 2 is not a palindrome. - Robert Israel, Dec 23 2025
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
59 is in the sequence because the palindromes between 29 and 59 are 33,44,55 and 59-55 = 4, 59-44 = 15, 59-33 = 26, all composite.
From Sean A. Irvine, Jan 31 2025: (Start)
2 is in the sequence because there are no palindromes between 1 and 2.
3 is in the sequence because the only palindrome between 3/2 and 3 is 2 and 3-2=1 is not prime.
23 is in the sequence because the only palindrome between 23/2 and 23 is 22 and 23-22=1 is not prime. (End)
MAPLE
N:=4; # for terms up to 10^N
digrev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
Pals:= $0..9:
for d from 2 to N do
if d::even then
m:= d/2;
Pals:= Pals, seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1);
else
m:= (d-1)/2;
Pals:= Pals, seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1);
fi
od:
Pals:=[Pals]:
filter:= proc(p) uses ListTools;
isprime(p) and not ormap(isprime,
p -~ Pals[BinaryPlace(Pals, p/2)+1 .. BinaryPlace(Pals, p)])
end proc:
select(filter, [2, seq(i, i=3..10^N, 2)]); # Robert Israel, Dec 23 2025
CROSSREFS
KEYWORD
AUTHOR
Jason Earls, Sep 11 2002
EXTENSIONS
Missing 3 inserted by Sean A. Irvine, Jan 31 2025
STATUS
approved
