This is my solution for generating prime numbers. With this code hopefully you can generate prime numbers with incredible speed. The generated numbers will be stored in a text file titled as "Primes.txt".

I have a dual core machine, but this program does not support dual core architecture, so it can only use one of the cores. Still the speed results are remarkable. On my 5600+ AMD, it is capable of generating 1 million prime numbers less than 8 seconds!

Compiled and tried under Vista, and Ubuntu 8.10. I use VisualStudio 2008 on Vista, and Code::Blocks 8.02 on Linux.

There is one drawback, the only even prime number 2 won't be displayed, ever.