#K61312. Can You Rearrange to Prime?
Can You Rearrange to Prime?
Can You Rearrange to Prime?
Given a positive integer \(N\), determine whether it is possible to rearrange its digits to form a prime number. The rearranged number must be a prime and should not have any leading zeroes.
For instance, for \(N = 13\), rearranging the digits can yield \(31\), which is a prime number, hence the answer is True
. However, for \(N = 15\), no permutation of its digits results in a prime number, so the answer is False
.
Note: The check must consider all permutations of the digits without allowing a permutation that starts with a zero.
inputFormat
The input consists of a single line containing a positive integer \(N\). This will be provided via standard input (stdin).
outputFormat
Output a single line: True
if some permutation of the digits of \(N\) forms a prime number (with no leading zeros), and False
otherwise. The output should be written to standard output (stdout).
13
True