login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A113612 a(1) = 3. For n > 1, a(n) = smallest prime not already seen forming a palindrome when a(n) and all previous terms are concatenated 2
3, 13, 313, 13313, 631331313313, 10131331313313631331313313, 1331363133131331310131331313313631331313313 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
From Michael S. Branicky, Aug 12 2022: (Start)
If terms are not constrained to be distinct, then 3, 3, 3, 3, ... and 3, 13, 13, 13, ... would be solutions.
a(12) has 1528 digits. (End)
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..11
EXAMPLE
3, 313, 313313, 31331313313, ... are all palindromes.
PROG
(Python)
from sympy import isprime
from itertools import count, islice, product
def pals(digs):
yield from digs
for d in count(2):
for p in product(digs, repeat=d//2):
left = "".join(p)
for mid in [[""], digs][d%2]:
yield left + mid + left[::-1]
def folds(s): # generator of suffixes of palindromes starting with s
for i in range((len(s)+1)//2, len(s)+1):
for mid in [True, False]:
t = s[:i] + (s[:i-1][::-1] if mid else s[:i][::-1])
if t.startswith(s):
yield t[len(s):]
yield from ("".join(p)+s[::-1] for p in pals("0123456789"))
def agen():
s, seen = "3", {"3"}; yield from [3]
while True:
for t in folds(s):
if len(t) and t[0] != "0" and t not in seen and isprime(int(t)):
break
s += t; seen.add(t); yield int(t)
print(list(islice(agen(), 7))) # Michael S. Branicky, Aug 12 2022
CROSSREFS
Cf. A113613.
Sequence in context: A000859 A045748 A113526 * A180654 A260576 A156358
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, Nov 09 2005
EXTENSIONS
Definition clarified by Felix Fröhlich, Oct 27 2014
Name clarified, a(2)-a(4) corrected, and a(5) and beyond from Michael S. Branicky, Aug 12 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 27 16:21 EDT 2024. Contains 373746 sequences. (Running on oeis4.)