Sort 18 Discussions, By:
Please Login in order to post a comment
all the prime numbers which contains 0/2/4/6/8/5 can't make a circular prime number because last digit with those number is not the prime number(divisible by 2 or 5) so sieve skill will have a powerful effect on reducing domain again...
Had timeout on last testcase until used an idea from your comment. Thanks!
Thanks for this Comment. Passed the last TC with your help.
Make sure you're testing ROTATIONS of the digits instead of permutations. I made that mistake.
One issue here is that it is not specified whether a prime which is circluar and \leq N is still defined to be circluar if its rotations happen to exceed N. Perhaps this distinction should be clarified.
Okay added it if this wasn't clear.
Can somebody(staff members) please give me a hint why I am getting WA.I think my logic is correct.Is there a problem with exceeding the value of data type?
I also got it wrong first, note that these are not permutable, but circular primes. http://primes.utm.edu/glossary/xpage/CircularPrime.html
For people using Python, I've found the collections.deque class to be pretty useful for this task!