Pandigital prime (source code)

= Pandigital prime

A <pandigital prime> is a <prime number> that is also a <pandigital number> for a specified <radix>, digit alphabet and repetition convention. For example, $2143$ uses each of $1,2,3,4$ exactly once and is <prime>; <trial division> by <prime numbers> at most its <square root> verifies the latter condition.

The <digit sum> supplies a useful obstruction. A decimal number using $1,\ldots,n$ exactly once has <digit sum> $n(n+1)/2$. If this sum is divisible by $3$ and the number exceeds $3$, the number is composite. In particular, a number using all ten <decimal digits> exactly once has <digit sum> $45$ and cannot be <prime>. The filter follows from the <digit sum> <integer congruence>, independently of the order in which the digits occur.