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!)
A088086 a(1) = 2; then smallest palindrome > 1 not occurring earlier such that every partial concatenation is a prime. 3
2, 3, 9, 11, 313, 33, 9339, 303, 909, 747, 383, 7, 969, 797, 141, 12721, 1881, 161, 343, 77, 333, 7227, 181, 737, 30603, 14841, 12621, 1111, 15051, 777, 939, 7887, 7997, 13231, 191, 79297, 13331, 11511, 19191, 38583, 3993, 949, 17171, 15351, 318813 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
2, 23, 239, 23911, etc. are primes.
MAPLE
A:= [1, 3, 7, 9]: B:= [1, 3, 7, 9]:
P:= 3, 7, 9, op(zip((s, t) -> s*10+t, A, B)):
for d from 1 to 6 do
P:= P, op(zip(proc(s, t) local i; seq(10^(d+1)*s + 10^d*i + t, i=0..9) end proc, A, B)):
A:= map(proc(t) local i; seq(10*t+i, i=0..9) end proc, A);
B:= map(proc(t) local i; seq(10^d*i+t, i=0..9) end proc, B);
P:= P, op(zip((s, t) -> 10^(d+1)*s+t, A, B));
od:
P:= [P]:
R:= 2: p:= 2:
for i from 2 to 50 do
for j from 1 do
v:= p*10^(1+ilog10(P[j]))+P[j];
if isprime(v) then
p:= v;
R:= R, P[j];
P:= subsop(j=NULL, P);
break
fi
od od:
R; # Robert Israel, Nov 15 2023
PROG
(Python)
from gmpy2 import is_prime
from itertools import count, islice, product
def bgen(): # generator of palindromic decimal strings ending in 1, 3, 7, 9
yield from "379"
for digits in count(2):
for first in "1379":
for left in product("0123456789", repeat=(digits-2)//2):
left = "".join(left)
right = left[::-1]
for mid in [[""], "0123456789"][digits%2]:
yield first + left + mid + right + first
def agen():
alst, aset, concat = [2], {"2"}, "2"
while True:
yield alst[-1]
g = bgen()
s = next(g)
while "start" in s or s in aset or not is_prime(int(concat + s)):
s = next(g)
concat += s
aset.add(s)
alst.append(int(s))
print(list(islice(agen(), 45))) # Michael S. Branicky, Nov 18 2023
CROSSREFS
Sequence in context: A287680 A242680 A275767 * A088084 A182203 A168080
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Sep 22 2003
EXTENSIONS
More terms from Sam Alexander, Nov 17 2003
More terms from David Wasserman, Jul 13 2005
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 September 17 12:50 EDT 2024. Contains 375987 sequences. (Running on oeis4.)