littly tiny bit faster?

This commit is contained in:
Matti 2024-04-16 11:50:49 +02:00
parent 9f957cab74
commit 095007f46d

View File

@ -9,7 +9,7 @@ public class aufg3 {
// ===================== // =====================
public static void main(String[] args){ public static void main(String[] args){
int MAXIMUM = 100_000_000; int MAXIMUM = 100_000_000; // takes about 13 seconds(!!)
int MAX_PER_ROW = 20; int MAX_PER_ROW = 20;
boolean[] primes = new boolean[MAXIMUM]; boolean[] primes = new boolean[MAXIMUM];
@ -32,8 +32,9 @@ public class aufg3 {
if(primes[i] && i > 1) { if(primes[i] && i > 1) {
System.out.print(i + " "); System.out.print(i + " ");
counter++; counter++;
if (counter % MAX_PER_ROW == 0) { if (counter == MAX_PER_ROW) {
System.out.println(); System.out.println();
counter = 0;
} }
} }
} }