OFFSET
1,2
COMMENTS
No more terms < 200000. - Stefan Steinerberger, Mar 19 2006
No more terms < 10 million. - Harvey P. Dale, Sep 25 2014
No more terms < 1 billion. - Michael S. Branicky, Jun 27 2022
EXAMPLE
prime(67999) = 855331.
MATHEMATICA
For[n = 1, n < 70000, n++, a := IntegerDigits[n]; c := 0; For[m = 1, m <= Length[a] -1, m++, If[a[[m]] > a[[m + 1]], c := 1; ]]; If[c == 0, a:=IntegerDigits[Prime[n]]; For[m = 1, m <= Length[a] - 1, m++, If[a[[m]] < a[[m + 1]], c := 1; ]]]; If[c == 0, Print[n]]] (* Stefan Steinerberger, Mar 19 2006 *)
nddQ[n_]:=Min[Differences[IntegerDigits[n]]]>-1&&Max[Differences[ IntegerDigits[ Prime[ n]]]]<1; Select[Range[70000], nddQ] (* Harvey P. Dale, Sep 25 2014 *)
PROG
(Python)
from sympy import sieve
from itertools import count, islice, combinations_with_replacement as mc
def ni(n): s = str(n); return s == "".join(sorted(s, reverse=True))
def bgen(d): yield from map(int, ("".join(m) for m in mc("123456789", d)))
def agen():
for d in count(1):
yield from (k for k in bgen(d) if ni(sieve[k]))
print(list(islice(agen(), 42))) # Michael S. Branicky, Jun 26 2022
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Giovanni Resta, Feb 13 2006
STATUS
approved