For base 10, the largest pandigital number of length 10 is 9876543210. You can successively create smaller pandigital numbers from that, and test them for primeness.
Algorithm::Loops or Algorithm::Permute might help you creating the numbers.
Somhow this looks like a project euler task to me - isn't it more fun to solve them on your own?
Perl 6 - links to (nearly) everything that is Perl 6.
| [reply] |
For base 10, the largest pandigital number of length 10 is 9876543210.
No 10 digit pandigital number is prime (the sum of their digits is 45, so they're all divisible by 3).
You can successively create smaller pandigital numbers from that, and test them for primeness.
Pointless. The smallest pandigital prime is 10123457689. (Sloane A050288)
| [reply] |
| [reply] |
want to write function that will return largest pandigital prime number based on passed parameter
That's a tall order. My first instinct would be to browse on the internet, and see whether someone already has a list. I don't find such a list on Sloane. It does have an entry for Pandigital primes, with some Mathematica code to generate them. But you'll have to generate millions of them to even get to the smallest number findLargest can return.
If I were to calculate them in Perl, I'd use PDL.
| [reply] [d/l] |