Generate and show all primes with strictly descending decimal digits.

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

Ascending primes


#!/usr/bin/perl
 
use strict; # https://rosettacode.org/wiki/Descending_primes
use warnings;
use ntheory qw( is_prime );
 
print join('', sort map { sprintf "%9d", $_ } grep /./ && is_prime($_),
  glob join '', map "{$_,}", reverse 1 .. 9) =~ s/.{45}\K/\n/gr;