One wayof doing this is to build up a list of primes until you have the required number.

So you may start with a seed list 2,3,5,7,11 (however long you want)

Then for you check integers sequentially for divisibility by the primes less than their square root, if not divisible by any of these then add to the list of primes.

This can be made more efficient by only checking odd numbers, and with added complexity elliminating other known composites from the search.

CB