login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Even numbers which are the sum of two palindromic primes.
2

%I #28 Dec 16 2024 02:13:21

%S 4,6,8,10,12,14,16,18,22,104,106,108,112,134,136,138,142,154,156,158,

%T 162,184,186,188,192,194,196,198,202,232,252,262,282,292,302,312,316,

%U 318,320,322,324,332,342,356,358,360,362,364,372,376,378,380,382,384,386

%N Even numbers which are the sum of two palindromic primes.

%H Robert Israel, <a href="/A377848/b377848.txt">Table of n, a(n) for n = 1..10000</a>

%e 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).

%p digrev:= proc(n) local L,i;

%p L:= convert(n,base,10);

%p add(L[-i]*10^(i-1),i=1..nops(L))

%p end proc:

%p F:= proc(d) # d-digit palindromic primes, d>=3 odd

%p local R,x,rx,i;

%p 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]))

%p end proc:

%p PP:= [3,5,7,11,op(F(3))]: nPP:= nops(PP):

%p A:= {4,seq(seq(PP[i] + PP[j],j=1..i),i=1..nPP)}:

%p sort(convert(A,list)); # _Robert Israel_, Dec 15 2024

%o (Python)

%o from sympy import isprime

%o from itertools import combinations_with_replacement

%o def is_palindrome(n):

%o return str(n) == str(n)[::-1]

%o palPrimes = set(); sums = set([4]) ; # init sum of 2+2

%o sumLimit = 1500 # this limit will generate sufficient sequence length for OEIS DATA section

%o # create list of palindrome primes

%o for n in range(3,sumLimit):

%o if isprime(n) and is_palindrome(n):

%o palPrimes.add(n)

%o # all combos of 2

%o c1 = combinations_with_replacement(palPrimes,2)

%o for i,j in c1:

%o if (i+j) < sumLimit: sums.d(i+j)

%o print(sorted(sums))

%o (PARI) ispal(x) = my(d=digits(x)); d == Vecrev(d);

%o 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

%Y Intersection of A287961 and A005843.

%Y Cf. A002385, A379138

%K nonn,base

%O 1,1

%A _James S. DeArmon_, Nov 09 2024