Determine whether permutation of the digits of a number is prime

272 Views Asked by At

Given a number $m$ in decimal representation. I want to find a permutation of the digits of $m$, so it is prime. (Or output that there exists none) Do i have in the worst case check every possible permutation or is there a faster approach (for example polynominal time approach)?