Generate and show all primes with strictly descending decimal digits.

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

Ascending primes


with javascript_semantics
function descending_primes(sequence res, atom p=0, max_digit=9)
    for d=1 to max_digit do
        atom np = p*10+d
        if odd(d) and is_prime(np) then res &= np end if
        res = descending_primes(res,np,d-1)
    end for
    return res
end function
 
sequence r = sort(descending_primes({2})),
--sequence r = descending_primes({2}),
         j = join_by(r,1,11," ","\n","%8d")
printf(1,"There are %,d descending primes:\n%s\n",{length(r),j})
