Prime Finder
A little project I made in a couple of hours that has a very fast algorithm to find primes.
I first made the code in Python, then made a copy in JavaScript. The Python version is about 8 times slower than the JavaScript version.
There are several optimisations I applied to the code, including:
- Skipping multiples of 2, 3, and 5 with an iterated increment
- Only checking factors up to the square root of each number (because any factors above the square root will have a corresponding factor below)
- Performing as little array duplication as possible
If you're going to be using numbers greater than 2^53 - 1
, you should use BigInt
s. The output number should tint orange if it is greater than the maximum safe integer (but I think it will just stop progressing if it reaches that number).
Published | 17 hours ago |
Status | Released |
Category | Tool |
Platforms | HTML5 |
Author | _andthereitgoes |
Leave a comment
Log in with itch.io to leave a comment.