generating prime number
Anonimo
You would be much more efficient using a prime sieve like the sieve of Eratosthenes or Atkins sieve. If you want to use trial division instead only divide until you get to the square root of the number you are checking. And after checking if the number is divisible by 2 you can start with 3 and only check odd numbers. 100 primes is really a trivial amount so it shouldn't matter, but if the point is to show problem solving skills I would probably go for a sieve of Eratosthenes with a 3,5,7 wheel.