+ 4
CHALLENGE : Pandigital Prime Number
What is a pandigital number ? An n-digit number is pandigital if it makes use of all the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital and is also prime. Challenge : Find all the n-digit pandigital prime numbers (n given by the user). Have fun and enjoy coding ! 😉 // Problem from Project Euler See my algorithm in Python (not optimised enough to run on SoloLearn). https://code.sololearn.com/c03Eb68ykIqM/?ref=app
15 ответов
+ 11
+ 7
Krishna's algorithm is amazing!
My one :(
https://code.sololearn.com/cEZ6nhyDMFU6/?ref=app
+ 7
Here's my try :
https://code.sololearn.com/c9Orce1zqPaN/?ref=app
+ 5
@Oberyin Thanks for the challenge. I enjoyed :)
+ 2
@LukArToDo and @ysraelcon Really good job !
+ 2
Oberyin please find my contribution to your challenge written in Python. While this runs well on a pc the code playground seems to restrict the time so that it will not run for numbers with 7-9 digits. All the same I hope the code is of interest.
https://code.sololearn.com/cejsNKgWvwj3/#py
+ 1
@Haris Try it on a computer, n=7 worked for me.
+ 1
@Shamima Yasmin Good job ! :)
+ 1
@Yash Thatte Well done !
Mine also needs to be optimised. On my computer, i can go up to 10 but on SoloLearn, it works only up to 6.
0
@Krishna Teja Yeluripati
Well done ! I hope it wasn't too easy !
0
@Krishna Teja Yeluripati
Your code seems to crash for input: 7 & 9.
For other cases works fine.
(tested on mobile)
0
Here you go. Checks for valid input
https://code.sololearn.com/ceq0o28i60wg/?ref=app
0
@Vari93 I just checked for 4 and it seems that your algorithm isn't working properly ^^
0
@Oberyn That's because it's checking all primes 1 - 4, so only 2 and 3. I set it up where it generates all primes from 2 to user given input. It then goes through all of the primes, finds it's length then checks if the numbers 1 - X, X being the length, is in the number.