How to find largest pandigital prime number ?

by perlCrazy (Monk)
 on Jul 23, 2010 at 09:16 UTC Need Help??
perlCrazy has asked for the wisdom of the Perl Monks concerning the following question:

want to write function that will return largest pandigital prime number based on passed parameter.
findLargest(\$numberOfDigits)
Can somebody point me in right direction or suggest some algorithm in perl so that I can call finction and return pandigital number.

Replies are listed 'Best First'.
Re: How to find largest pandigital prime number ?
by moritz (Cardinal) on Jul 23, 2010 at 09:57 UTC
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.

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.
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)
Re: How to find largest pandigital prime number ?
by Anonymous Monk on Jul 23, 2010 at 09:29 UTC
Re: How to find largest pandigital prime number ?
by JavaFan (Canon) on Jul 23, 2010 at 11:56 UTC
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.

Create A New User
Node Status?
node history
Node Type: perlquestion [id://850995]
Approved by planetscape
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2017-05-30 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favorite model of computation is ...

Results (198 votes). Check out past polls.