Saturday, February 15, 2014

Prime Sieve

Found a Prime Sieve function online and tested it, took ~3570ms to generate primes up to 10,000,000. Was pretty fast compared to the one I made awhile back so I decided to make a new one tailored to be faster than the one I just found. My final version takes ~2790ms to generate primes up to 10,000,000. Code I found was originally in C# but I converted it to VB.net.
Note: Speeds may vary per machine.

Sieve I made with use of multiplication instead of modulus (even faster than stated above):

Sieve I made:

Sieve I found:
Note: Any errors or improvements please post in comments.

No comments: