OFFSET
1,1
COMMENTS
a(n) - 1 is a palindrome. Obviously 7, 5 and 3 are the only palindromic terms. Conjecture: Sequence is infinite.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
353 is a member of A109862 and 647 = 1000 - 353 corresponds to it.
PROG
(Python)
from sympy import isprime
from itertools import product
def tc(n): return 10**len(str(n)) - n
def cond(p): return isprime(p) and isprime(tc(p))
def palcands(digs):
if digs == 1: yield from [2, 3, 5, 7]; return
if digs%2 == 0: yield from [[], [11]][digs==2]; return
for first in "1379":
for p in product("0123456789", repeat=(digs-2)//2):
left = first + "".join(p)
for mid in "0123456789": yield int(left + mid + left[::-1])
def auptod(digs):
return [tc(p) for d in range(1, digs+1) for p in palcands(d) if cond(p)]
print(auptod(7)) # Michael S. Branicky, Jul 05 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Jul 08 2005
EXTENSIONS
More terms from Joshua Zucker, May 08 2006
Corrected by T. D. Noe, Nov 15 2006
a(37) and beyond from Michael S. Branicky, Jul 05 2021
STATUS
approved