Generate and show all primes with strictly descending decimal digits.

See also
 OEIS:A052014 - Primes with distinct digits in descending order
Related

Ascending primes


 
load "stdlibcore.ring"
 
limit = 1000
row = 0
 
for n = 1 to limit
    flag = 0
    strn = string(n)
    if isprime(n) = 1
       for m = 1 to len(strn)-1
           if number(substr(strn,m)) < number(substr(strn,m+1))
              flag = 1
           ok
       next
       if flag = 1
          row++
          see "" + n + " "
       ok
       if row % 10 = 0
          see nl
       ok
    ok
next
 