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.

A356881 Palindromes that can be written in more than one way as the sum of two palindromic primes.

This page as a plain text file.
%I A356881 #11 Feb 22 2024 20:11:30
%S A356881 202,282,484,858,888,21912,22722,23832,24642,24842,25752,26662,26762,
%T A356881 26862,26962,27672,27772,27872,27972,28482,28682,28782,28882,28982,
%U A356881 29692,29792,29892,29992,40704,41514,41614,41814,42624,42824,42924,43434,43734
%N A356881 Palindromes that can be written in more than one way as the sum of two palindromic primes.
%C A356881 This sequence doesn't contain any numbers with an even number of digits, see proof in A356824.
%C A356881 Subsequence of A356824.
%C A356881 Supersequence of A356854, which requires the two palindromic primes to be distinct. For example, 202, 24842, and 28682 are in this sequence but not in A356854.
%C A356881 All numbers in this sequence are even. Proof: any two consecutive multi-digit palindromes differ by at least 10, so larger palindromes can't be the sum of a palindromic prime and 2. Thus, each term is the sum of two odd numbers.
%e A356881 282 can be expressed as the sum of two palindromic primes in two ways: 282 = 101 + 181 = 131 + 151. Thus, 282 is in this sequence. Similarly, 202 = 101 + 101 = 11 + 191.
%t A356881 q := Select[Range[50000], PalindromeQ[#] && PrimeQ[#] &]Sort[Transpose[Select[Tally[ Flatten[Table[ q[[n]] + q[[m]], {n, Length[q]}, {m, n, Length[q]}]]],PalindromeQ[#[[1]]] && #[[2]] > 1 &]][[1]]]
%o A356881 (Python)
%o A356881 from sympy import isprime
%o A356881 from itertools import product
%o A356881 def ispal(n): s = str(n); return s == s[::-1]
%o A356881 def oddpals(d): # generator of odd palindromes with d digits
%o A356881     if d == 1: yield from [1, 3, 5, 7, 9]; return
%o A356881     for first in "13579":
%o A356881         for p in product("0123456789", repeat=(d-2)//2):
%o A356881             left = "".join(p); right = left[::-1]
%o A356881             for mid in [[""], "0123456789"][d%2]:
%o A356881                 yield int(first + left + mid + right + first)
%o A356881 def auptod(dd):
%o A356881     N, alst, pp, once, twice = 10**dd, [], [2, 3, 5, 7, 11], set(), set()
%o A356881     pp += [p for d in range(3, dd+1, 2) for p in oddpals(d) if isprime(p)]
%o A356881     sums = (p+q for p in pp for q in pp if p<=q and p+q<N and ispal(p+q))
%o A356881     for s in sums:
%o A356881         if s in once: twice.add(s)
%o A356881         else: once.add(s)
%o A356881     return sorted(twice)
%o A356881 print(auptod(5)) # _Michael S. Branicky_, Sep 02 2022
%Y A356881 Cf. A356824, A356854.
%K A356881 nonn,base
%O A356881 1,1
%A A356881 _Tanya Khovanova_, Sep 02 2022