Sieve of Aktin next
If you are building a list of prime numbers than you only need to test division by those numbers. Also hardcode 2 and only test odd numbers for a tiny boost. Replace i < sqrt(n) with i * i < n for another little boost.
Love your content, but i've got a little suggestion: next time if you're doing a comparison of some sort, make the times equal, because in this video you ran some for 5mins, some for 10secs
A couple years ago, I wrote a C program using the Sieve of Eratosthenes. Getting up to the number 1 billion took about 84 seconds. Instead of using an array of bools, I used an array of ints and used bitshifting operations so each prime number is stored as a single bit (true or false, representing prime or not). I also acted like even numbers didn't exist, so I didn't have to multiply by 2, or multiply any of the prime numbers by an even number. This cut the number of multiplications by half. It was an interesting little experiment.
I just use curl to the prime page and parse it. Time complexity is O(1)
I’ve done my self some optimisations to the sieve of Eratosthenes, first optimisation is using just odd numbers, as every even number different than 2 is not prime, and then some code optimisations for calculation. And then I used bit array instead of list of bools so that it takes 8 times less in the memory, although it made it a bit slower to run, but still faster than original untouched sieve. So now I have a sieve that runs around 1.5 times faster and that takes 8 times less memory to run.
another way to make this faster is by implementing it in C++ or even just C#. maybe rust?
division gets harder as numbers get greater. other binary operations do so, but division is worse among them
I love your content and how you explain things
Prime is an ultrakill refference
you could use multi-threading to make it even faster, and since we know 1 & 2 are already prime numbers, you can already put them in the list and then start from 2
a video on "how to break encryption using'em".
I don't no this algorithm but i implemented the same algorithm😂
Muller Rabin primality test is used to generate 1000s of digit long primes
Maybe use C/C++ for faster code execution instead of turtle speed python
Would the Miller-Rabin-Prime-Test faster for larger numbers?
use numpy and you'll 10x that 😭😭😭
Impressive. Very nice.. lets see Paul Allen's sieve
Loved it!!
@handerixgrr4587