login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A127827
Smallest n-digit emirp (A006567) with nondecreasing digits.
2
13, 113, 1223, 11149, 111119, 1111339, 11111117, 111111199, 1111111999, 11111111113, 111111111149, 1111111111267, 11111111111257, 111111111113447, 1111111111112227, 11111111111122223, 111111111111113569, 1111111111111113779, 11111111111111133677, 111111111111111111157, 1111111111111111122359, 11111111111111111133469
OFFSET
2,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 2..529 (terms 2..225 from Robert Israel)
MAPLE
nextl:= proc(L)
local m, k, r;
# L a list of digits 1-9, last odd, in nondecreasing order
if L[-1]<= 7 then return subsop(-1=L[-1]+2, L) fi;
m:= nops(L); k:= m-1;
while L[k] =9 do k:= k-1 od:
r:= [op(L[1..k-1]), (L[k]+1) $ (m+1-k)];
if r[-1]::even then r:= subsop(-1=r[-1]+1, r) fi;
r
end proc:
f:= proc(n) local L, p, q, i;
L:= [1$n];
do
p:= add(L[i]*10^(i-1), i=1..n);
q:= add(L[-i]*10^(i-1), i=1..n);
if q <> p and isprime(p) and isprime(q) then return(q) fi;
L:= nextl(L);
od
end proc:
map(f, [$2..30]); # Robert Israel, Nov 19 2017
PROG
(Python)
from sympy import isprime
from itertools import count, islice, combinations_with_replacement as mc
def bgen(d):
nd = ("".join(m) for m in mc("123456789", d))
yield from filter(isprime, map(int, nd))
def ok(ndp):
s = str(ndp)
return len(set(s)) != 1 and isprime(int(s[::-1]))
def agen():
yield from (next(filter(ok, bgen(d))) for d in count(2))
print(list(islice(agen(), 22))) # Michael S. Branicky, Jun 26 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ray Chandler, Jan 31 2007
EXTENSIONS
More terms from Robert Israel, Nov 19 2017
STATUS
approved