Generates prime numbers up to a specified number.