We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Time Complexity: Primality
- Discussions
Time Complexity: Primality
Time Complexity: Primality
Sort by
recency
|
202 Discussions
|
Please Login in order to post a comment
Actually, there's an O(logN) solution. Here's my code, it works for all numbers from 1 to 2^64. It's based on Miller-Rabin test, with a proven array of bases from this site.
Python solution:
My solution Java 7 (I haven't read the editorial yet)