cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A377848 #31 Jun 02 2025 18:26:16
%S A377848 4,6,8,10,12,14,16,18,22,104,106,108,112,134,136,138,142,154,156,158,
%T A377848 162,184,186,188,192,194,196,198,202,232,252,262,282,292,302,312,316,
%U A377848 318,320,322,324,332,342,356,358,360,362,364,372,376,378,380,382,384,386
%N A377848 Even numbers which are the sum of two palindromic primes.
%H A377848 Robert Israel, <a href="/A377848/b377848.txt">Table of n, a(n) for n = 1..10000</a>
%e A377848 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 A377848 digrev:= proc(n) local L,i;
%p A377848   L:= convert(n,base,10);
%p A377848   add(L[-i]*10^(i-1),i=1..nops(L))
%p A377848 end proc:
%p A377848 F:= proc(d) # d-digit palindromic primes, d>=3 odd
%p A377848  local R,x,rx,i;
%p A377848     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 A377848 end proc:
%p A377848 PP:= [3,5,7,11,op(F(3))]: nPP:= nops(PP):
%p A377848 A:= {4,seq(seq(PP[i] + PP[j],j=1..i),i=1..nPP)}:
%p A377848 sort(convert(A,list)); # _Robert Israel_, Dec 15 2024
%o A377848 (Python)
%o A377848 from sympy import isprime
%o A377848 from itertools import combinations_with_replacement
%o A377848 def is_palindrome(n):
%o A377848     return str(n) == str(n)[::-1]
%o A377848 palPrimes = set(); sums = set([4]) ; # init sum of 2+2
%o A377848 sumLimit = 1500 # this limit will generate sufficient sequence length for OEIS DATA section
%o A377848 # create list of palindrome primes
%o A377848 for n in range(3,sumLimit):
%o A377848     if isprime(n) and is_palindrome(n):
%o A377848         palPrimes.add(n)
%o A377848 # all combos of 2
%o A377848 c1 = combinations_with_replacement(palPrimes,2)
%o A377848 for i,j in c1:
%o A377848     if (i+j) < sumLimit: sums.add(i+j)
%o A377848 print(sorted(sums))
%o A377848 (PARI) ispal(x) = my(d=digits(x)); d == Vecrev(d);
%o A377848 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 A377848 Intersection of A287961 and A005843.
%Y A377848 Cf. A002385, A379138
%K A377848 nonn,base
%O A377848 1,1
%A A377848 _James S. DeArmon_, Nov 09 2024