A127828 Largest n-digit emirp (A006567) with nonincreasing digits.
97, 991, 9941, 99881, 999983, 9999971, 99999643, 999999761, 9999999511, 99999999977, 999999998863, 9999999998633, 99999999998333, 999999999999877, 9999999999998633, 99999999999987443, 999999999999999331, 9999999999999988633, 99999999999999999631
Offset: 2
Links
- Michael S. Branicky, Table of n, a(n) for n = 2..527
Programs
-
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 *)
-
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
Extensions
a(19) and beyond from Michael S. Branicky, Jun 26 2022