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”).

A377848
Even numbers which are the sum of two palindromic primes.
2
4, 6, 8, 10, 12, 14, 16, 18, 22, 104, 106, 108, 112, 134, 136, 138, 142, 154, 156, 158, 162, 184, 186, 188, 192, 194, 196, 198, 202, 232, 252, 262, 282, 292, 302, 312, 316, 318, 320, 322, 324, 332, 342, 356, 358, 360, 362, 364, 372, 376, 378, 380, 382, 384, 386
OFFSET
1,1
LINKS
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
Intersection of A287961 and A005843.
Sequence in context: A175246 A353537 A134928 * A279040 A141109 A333197
KEYWORD
nonn,base
AUTHOR
James S. DeArmon, Nov 09 2024
STATUS
approved