How would you go about coding a function to find the first x number of primes? I just can't figure out how to even start it. I'd greatly appriciate any help. Thanks
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 ...
How would you go about coding a function to find the first x number of primes? I just can't figure out how to even start it. I'd greatly appriciate any help. Thanks
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).
Not the most efficient means of checking for primes, but it works.
Actually, you do not need to check divisibility for all numbers less than the one you are currently testing, only all numbers less than or equal to the square root of the number.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
Cool. Thanks a lot.