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.

A256048 Smallest palindromic prime by adding at least one digit to both the left and right of n.

This page as a plain text file.
%I A256048 #15 Jul 23 2025 15:12:52
%S A256048 101,313,727,131,11411,151,10601,373,181,191,30103,1114111,1120211,
%T A256048 11311,11411,31513,1160611,1117111,18181,71917,30203,1120211,72227,
%U A256048 32323,12421,1250521,36263,12721,12821,39293,10301,11311,32323,13331,14341,33533,16361,77377
%N A256048 Smallest palindromic prime by adding at least one digit to both the left and right of n.
%H A256048 Chai Wah Wu, <a href="/A256048/b256048.txt">Table of n, a(n) for n = 0..10000</a>
%o A256048 (Python)
%o A256048 from __future__ import division
%o A256048 from sympy import isprime
%o A256048 def palgenrange2(m,l): # generator of odd-length palindromes of length at least m and at most 2*l
%o A256048     if m == 1:
%o A256048         yield 0
%o A256048     for x in range(m//2+1,l+1):
%o A256048         n = 10**(x-1)
%o A256048         for y in range(n,n*10):
%o A256048             s = str(y)
%o A256048             yield int(s+s[-2::-1])
%o A256048 def A256048(n):
%o A256048     sn = str(n)
%o A256048     for p in palgenrange2(len(sn)+2,len(sn)+20):
%o A256048         if sn in str(p)[1:-1] and isprime(p):
%o A256048             break
%o A256048     else:
%o A256048         return 'search limit reached'
%o A256048     return p # _Chai Wah Wu_, Mar 22 2015
%Y A256048 Cf. A090287
%K A256048 nonn,base
%O A256048 0,1
%A A256048 _Felix Fröhlich_, Mar 10 2015
%E A256048 a(10), a(12), a(16), a(18) corrected by _Chai Wah Wu_, Mar 22 2015