littly tiny bit faster?
This commit is contained in:
parent
9f957cab74
commit
095007f46d
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user