Prime Numbers

This is a discussion on Prime Numbers within the C++ Programming forums, part of the General Programming Boards category; How would you go about coding a function to find the first x number of primes? I just can't figure ...

A simple way of working them out is to divide each number by every number lower than itself (except 1) and if none of the divisions result in a remainder of zero then you have a prime number (there are ways of speeding up this algorithm).