login
Smallest palindromic prime p, larger than previous term, such that concatenation of n and p is a prime.
1

%I #7 Mar 11 2021 21:06:46

%S 3,11,181,373,12821,14741,32323,72227,74747,77977,78887,79997,90709,

%T 94049,94849,98689,1055501,1065601,1114111,1129211,1134311,1177711,

%U 1180811,1186811,1190911,1262621,1333331,1338331,1407041,1409041,1411141,1461641,1463641

%N Smallest palindromic prime p, larger than previous term, such that concatenation of n and p is a prime.

%C Cf. A096915

%e a(4) = 373 because 4373 is prime, while 4191, 4313, 4353 are all composite.

%o (Python)

%o from sympy import isprime, nextprime

%o def ispal(n): s = str(n); return s == s[::-1]

%o def aupto(lim):

%o n, p, alst = 1, 2, []

%o while p <= lim:

%o if ispal(p) and isprime(int(str(n)+str(p))): n, alst = n + 1, alst + [p]

%o p = nextprime(p)

%o return alst

%o print(aupto(1463641)) # _Michael S. Branicky_, Mar 11 2021

%Y Cf. A096915, A103835.

%Y Subsequence of A002385.

%K nonn,base

%O 1,1

%A _Zak Seidov_, Mar 30 2005