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.

A127827 Smallest n-digit emirp (A006567) with nondecreasing digits.

This page as a plain text file.
%I A127827 #13 Jun 27 2022 01:11:29
%S A127827 13,113,1223,11149,111119,1111339,11111117,111111199,1111111999,
%T A127827 11111111113,111111111149,1111111111267,11111111111257,
%U A127827 111111111113447,1111111111112227,11111111111122223,111111111111113569,1111111111111113779,11111111111111133677,111111111111111111157,1111111111111111122359,11111111111111111133469
%N A127827 Smallest n-digit emirp (A006567) with nondecreasing digits.
%H A127827 Michael S. Branicky, <a href="/A127827/b127827.txt">Table of n, a(n) for n = 2..529</a> (terms 2..225 from Robert Israel)
%p A127827 nextl:= proc(L)
%p A127827 local m,k,r;
%p A127827 # L a list of digits 1-9, last odd, in nondecreasing order
%p A127827 if L[-1]<= 7 then return subsop(-1=L[-1]+2, L) fi;
%p A127827 m:= nops(L); k:= m-1;
%p A127827 while L[k] =9 do k:= k-1 od:
%p A127827 r:= [op(L[1..k-1]),(L[k]+1) $ (m+1-k)];
%p A127827 if r[-1]::even then r:= subsop(-1=r[-1]+1, r) fi;
%p A127827 r
%p A127827 end proc:
%p A127827 f:= proc(n) local L,p,q,i;
%p A127827   L:= [1$n];
%p A127827   do
%p A127827     p:= add(L[i]*10^(i-1),i=1..n);
%p A127827     q:= add(L[-i]*10^(i-1),i=1..n);
%p A127827     if q <> p and isprime(p) and isprime(q) then return(q) fi;
%p A127827     L:= nextl(L);
%p A127827   od
%p A127827 end proc:
%p A127827 map(f, [$2..30]); # _Robert Israel_, Nov 19 2017
%o A127827 (Python)
%o A127827 from sympy import isprime
%o A127827 from itertools import count, islice, combinations_with_replacement as mc
%o A127827 def bgen(d):
%o A127827     nd = ("".join(m) for m in mc("123456789", d))
%o A127827     yield from filter(isprime, map(int, nd))
%o A127827 def ok(ndp):
%o A127827     s = str(ndp)
%o A127827     return len(set(s)) != 1 and isprime(int(s[::-1]))
%o A127827 def agen():
%o A127827     yield from (next(filter(ok, bgen(d))) for d in count(2))
%o A127827 print(list(islice(agen(), 22))) # _Michael S. Branicky_, Jun 26 2022
%Y A127827 Cf. A006567, A031991, A114018, A127747, A127828.
%K A127827 nonn,base
%O A127827 2,1
%A A127827 _Ray Chandler_, Jan 31 2007
%E A127827 More terms from _Robert Israel_, Nov 19 2017