Changed the HASH_SIZE (it dropped the required time for p = 7 from 105 seconds to 32 seconds). Then changed the LIMIT and it dropped to 19 seconds.
Stergios Upload Compile Checker / Explore-Gitea-Actions (push) Successful in 8s
Stergios Upload Compile Checker / Explore-Gitea-Actions (push) Successful in 8s
This commit is contained in:
3 files changed
+4
-7
No files matched your search
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define HASH_SIZE 2000003
|
#define HASH_SIZE 50000017
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Hashes three 128-bit integers into a single unsigned int
|
* @brief Hashes three 128-bit integers into a single unsigned int
|
||||||
|
|||||||
+2
-4
@@ -87,13 +87,11 @@ void generate_factor_pairs(int128_t* sum, int32_t prime_index, int32_t* exponent
|
|||||||
int128_t r2a = values[1] / gcd2, r2b = values[2] / gcd2, r2c = val2 / gcd2;
|
int128_t r2a = values[1] / gcd2, r2b = values[2] / gcd2, r2c = val2 / gcd2;
|
||||||
|
|
||||||
if (is_new_root(r1a, r1b, r1c)) {
|
if (is_new_root(r1a, r1b, r1c)) {
|
||||||
int128_t greater = max2(r1b, r1c);
|
LIMIT = max3(r1a, r1b, r1c) * min3(r1a, r1b, r1c) / 4;
|
||||||
LIMIT = r1a >= greater ? r1a * greater / 2 : r1b * r1c / 2;
|
|
||||||
solve(sum, gcd1, r1a, r1b, r1c, print_mode, output);
|
solve(sum, gcd1, r1a, r1b, r1c, print_mode, output);
|
||||||
}
|
}
|
||||||
if (val2 >= 0 && is_new_root(r2a, r2b, r2c)) {
|
if (val2 >= 0 && is_new_root(r2a, r2b, r2c)) {
|
||||||
int128_t greater = max2(r2b, r2c);
|
LIMIT = max3(r2a, r2b, r2c) * min3(r2a, r2b, r2c) / 4;
|
||||||
LIMIT = r2a >= greater ? r2a * greater / 2 : r2b * r2c / 2;
|
|
||||||
solve(sum, gcd2, r2a, r2b, r2c, print_mode, output);
|
solve(sum, gcd2, r2a, r2b, r2c, print_mode, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -178,8 +178,7 @@ int main() {
|
|||||||
int128_t ra = a0 / gcd, rb = b0 / gcd, rc = c0 / gcd;
|
int128_t ra = a0 / gcd, rb = b0 / gcd, rc = c0 / gcd;
|
||||||
|
|
||||||
if (is_new_root(ra, rb, rc)) {
|
if (is_new_root(ra, rb, rc)) {
|
||||||
int128_t greater = max2(rb, rc);
|
LIMIT = max3(ra, rb, rc) * min3(ra, rb, rc) / 4;
|
||||||
LIMIT = ra >= greater ? ra * greater / 2 : rb * rc / 2;
|
|
||||||
solve(&sum, gcd, ra, rb, rc, print_mode, f_output);
|
solve(&sum, gcd, ra, rb, rc, print_mode, f_output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user