login
A127828
Largest n-digit emirp (A006567) with nonincreasing digits.
2
97, 991, 9941, 99881, 999983, 9999971, 99999643, 999999761, 9999999511, 99999999977, 999999998863, 9999999998633, 99999999998333, 999999999999877, 9999999999998633, 99999999999987443, 999999999999999331, 9999999999999988633, 99999999999999999631
OFFSET
2,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 2..527
MATHEMATICA
nde[n_]:=Module[{p=NextPrime[10^n, -1]}, While[Max[Differences[ IntegerDigits[ p]]]>0 || CompositeQ[IntegerReverse[p]], p=NextPrime[ p, -1]]; p]; Array[nde, 17, 2] (* Harvey P. Dale, Mar 13 2020 *)
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("987654321", 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(), 20))) # Michael S. Branicky, Jun 26 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ray Chandler, Jan 31 2007
EXTENSIONS
a(19) and beyond from Michael S. Branicky, Jun 26 2022
STATUS
approved