Optimization

This commit is contained in:
Matti Bos 2024-06-23 21:28:13 +02:00
parent 8a8589a25d
commit 80253dc3e8

View File

@ -9,7 +9,7 @@ public class aufg3 {
// =====================
public static void main(String[] args){
int MAXIMUM = 10_000_000; // takes about 13 seconds(!!)
int MAXIMUM = 100_000_000; // takes about 4 seconds(!!)
int MAX_PER_ROW = 20;
boolean[] primes = new boolean[MAXIMUM];
@ -17,7 +17,7 @@ public class aufg3 {
Arrays.fill(primes, true);
for(int i=2; i < MAXIMUM * 0.5; i++){
for(int j=2; j < ((MAXIMUM*1.0)/i); j++){
for(int j=i; j < ((MAXIMUM*1.0)/i); j++){
int index = i * j;