Hope it hasn't been done before D:
But anyway, I did it all by myself. Took about two to three days of on and off thinking to figure out how to get it working. It seems to work correctly, comments and criticism of my probably horrible code are welcome.
http://pi.monkeh.net/prime.cpp