(Added the GCD improvement to mode 1 too.
This commit is contained in:
+3
-7
@@ -5,11 +5,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#define HASH_SIZE 200003
|
||||
//#define LIMIT 100000000LL
|
||||
|
||||
//#define HASH_SIZE 200000003
|
||||
//const int128_t LIMIT = (int128_t)1000000000ULL * 1000000000ULL * 1000000000ULL;
|
||||
|
||||
int128_t LIMIT = 0;
|
||||
|
||||
typedef struct Node {
|
||||
@@ -197,14 +192,15 @@ int main() {
|
||||
}
|
||||
|
||||
int128_t greater = b0 >= c0 ? b0 : c0;
|
||||
LIMIT = a0 >= greater ? a0 * greater / 2 : b0 * c0 / 2;
|
||||
int128_t gcd = gcd3(a0, b0, c0);
|
||||
LIMIT = a0 >= greater ? a0 * greater / (2 * gcd * gcd) : b0 * c0 / (2 * gcd * gcd);
|
||||
|
||||
if (!safe_val(a0) || !safe_val(b0) || !safe_val(c0)) {
|
||||
fprintf(stderr, "Initial values exceed safe limit.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
run_bfs(&sum, a0, b0, c0, print_mode);
|
||||
run_bfs(&sum, a0 / gcd, b0 / gcd, c0 / gcd, print_mode);
|
||||
} else if (mode == 2) {
|
||||
int p = 3;
|
||||
int exponents[3] = {2*p + 2, p, p};
|
||||
|
||||
Reference in New Issue
Block a user