/* * Find all of the prime number less than 1000 * * Could be more efficient * * Created: August 2023 * @author gtowell */ public class Primes { public static void main(String[] args) { for (int i = 2; i < 1000; i++) { boolean isPrime = true; for (int j = 2; j < i; j++) { if (i % j == 0) { isPrime = false; } } if (isPrime) { System.out.println(i); } } } }