I'm trying to solve Problem 41of project Euler in Java, by counting the number from 99888888 to 80000000(which took very long time :( ), I got 98765431 as an answer, but I'm getting that answer not correct. Could anyone please tell me the reason of not getting the correct answer and how can I speed my program?
A pandigital number doesn't needs to contain all numbers from 1 to 9
, but all from 1 to length
.
So, you'll need to try all permutations from 1 to 9
starting with 1 digit and going up, filtering all prime numbers and, then, taking largest one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With