So i have been working on finding prime numbers using c++ programs for a while now. Here is my question does anyone know of an effeicent way of finding them. I have been using the % function and just dividing by every possible number up to the current number but as most of you know when you hit 1 billion you are talking a few days before it has finished. I am a math major but not really that far into it all the efficeint ways I know of work great on paper but when you try to program them infinity gets in the way and the program tells you bad things and dies.

Thanks in advance,
starripper