Hardcore Optimization

~ 1000% faster
This commit is contained in:
Matti 2024-04-16 11:39:31 +02:00
parent 07f3f6be4b
commit 9f957cab74

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; int MAXIMUM = 100_000_000;
int MAX_PER_ROW = 20; int MAX_PER_ROW = 20;
boolean[] primes = new boolean[MAXIMUM]; boolean[] primes = new boolean[MAXIMUM];
@ -17,7 +17,7 @@ public class aufg3 {
Arrays.fill(primes, true); Arrays.fill(primes, true);
for(int i=2; i < MAXIMUM * 0.5; i++){ for(int i=2; i < MAXIMUM * 0.5; i++){
for(int j=2; j < MAXIMUM; j++){ for(int j=2; j < ((MAXIMUM*1.0)/i); j++){
int index = i * j; int index = i * j;