About a year ago, I released a prime generator written in C#, which was able to generate 1.000.000 primes in about 45 minutes.
Anyway, myself and a bloke from my class decided to have a programming competition to see who was able to make the most efficient prime generator in a language of our choice. I initially tried accomplishing this in Java (Don’t ever do this – BigInteger is a bitch), which accomplished the task in a mere 15 minutes.
Following this, my competitor decided to turn to C++ to defeat me. And he did. Big time.
His program was able to generate 1.000.000 primes in a mere 20 seconds, defeating me by several miles.
Frustrated by my loss, I also turned to C++, where I made a program, which was able to generate 1.000.000 primes in less than 3 seconds (2.90867, to be exact).
The competition was hereby concluded.
Just for fun, here’s a link to the source code of the C++ program: