OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
The first term is 4 (2+2), the second term is 6 (3+3). The first term involving a double-digit addend is 14 (3+11).
MAPLE
digrev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
F:= proc(d) # d-digit palindromic primes, d>=3 odd
local R, x, rx, i;
select(isprime, map(t -> seq(10^((d+1)/2)*t + i*10^((d-1)/2) + digrev(t), i=0..9), [$(10^((d-3)/2)) .. 10^((d-1)/2)-1]))
end proc:
PP:= [3, 5, 7, 11, op(F(3))]: nPP:= nops(PP):
A:= {4, seq(seq(PP[i] + PP[j], j=1..i), i=1..nPP)}:
sort(convert(A, list)); # Robert Israel, Dec 15 2024
PROG
(Python)
from sympy import isprime
from itertools import combinations_with_replacement
def is_palindrome(n):
return str(n) == str(n)[::-1]
palPrimes = set(); sums = set([4]) ; # init sum of 2+2
sumLimit = 1500 # this limit will generate sufficient sequence length for OEIS DATA section
# create list of palindrome primes
for n in range(3, sumLimit):
if isprime(n) and is_palindrome(n):
palPrimes.add(n)
# all combos of 2
c1 = combinations_with_replacement(palPrimes, 2)
for i, j in c1:
if (i+j) < sumLimit: sums.d(i+j)
print(sorted(sums))
(PARI) ispal(x) = my(d=digits(x)); d == Vecrev(d);
isok(k) = if (!(k%2), forprime(p=2, k\2, if (ispal(p) && isprime(k-p) && ispal(k-p), return(1)))); \\ Michel Marcus, Nov 15 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
James S. DeArmon, Nov 09 2024
STATUS
approved