A110787 Least palindrome which when appended to the n-th palindrome gives a prime.
1, 3, 1, 1, 3, 1, 1, 3, 7, 3, 3, 1, 3, 7, 1, 3, 1, 1, 3, 7, 3, 9, 77, 1, 3, 131, 1, 3, 7, 9, 1, 171, 3, 1, 1, 9, 11, 7, 7, 7, 77, 1, 3, 3, 1, 3, 3, 1, 9, 11, 1, 9, 1, 7, 3, 101, 111, 3, 1, 3, 11, 1, 77, 7, 1, 131, 1, 3, 7, 3, 3, 1, 9, 3, 1, 1, 3, 1, 9, 7, 33, 111, 7, 3, 3, 11, 3, 77, 1, 99, 7, 7, 11, 1, 1
Offset: 1
Crossrefs
Cf. A110786.
Programs
-
Python
from itertools import count from sympy import isprime def A110787(n): s = str((c:=n+1-x)*x+int(str(c)[-2::-1] or 0) if n+1<(x:=10**(len(str(n+1>>1))-1))+(y:=10*x) else (c:=n+1-y)*y+int(str(c)[::-1] or 0)) for k in count(2): if isprime(int(s+str(q:=(c:=k-x)*x+int(str(c)[-2::-1] or 0) if k<(x:=10**(len(str(k>>1))-1))+(y:=10*x) else (c:=k-y)*y+int(str(c)[::-1] or 0)))): return int(q) # Chai Wah Wu, Jul 10 2024
Extensions
More terms from Franklin T. Adams-Watters, Oct 11 2006
Comments