public class Primtal { public static void main(String[] args) { int antalPrimtal = 0; int tal; int faktor; for (tal = 50000; tal<100000; tal++) { faktor = 2; while (tal % faktor > 0) faktor++; if (faktor == tal) { System.out.print(tal + " er et primtal.\n"); antalPrimtal = antalPrimtal + 1; } } System.out.println("Antal primtal i alt: " + antalPrimtal); } }