This directory contains a fast, memory efficient implementation of a variant of the greedy algorithm that yields slightly worse lower bounds on
An implementation of the standard greedy algorithm is included in the same program, but its range is restricted to
This implementation depends on Kim Walisch's primesieve and primecount libraries for enumerating and counting primes, which must be installed before you compile the code in this directory.
These two libraries are used to efficiently handle factors divisible by primes in the range primesieve to enumerate primes, for large regions primecount to compute
To verify the Erdos-Guy-Selfridge conjecture for egs.c using build.sh, you can type
./egs -h hint_67425_1e6_exhaustive_greedy.txt 67425-1e6
./egs -f -h hint_1e6_1e11_heuristic_fast.txt 1e6-1e11
This should take 10-20 seconds (depending on your CPU). Note that you need to include the -f option to use the fast variant of the greedy algorithm in the second line, as the standard greedy algorithm will be used by default, and our C implementation of the standard greedy algorithm only supports
To verify the range
./egs -f -h hint_1e11_1e14_heuristic_fast.txt 1e11-1e14
which should take 5-10 minutes (again, depending on your CPU).
The hint-files contain lists of pairs
To recreate the hint-file hint_1e6_1e11_heuristic_fast.txt (or create a new one for a different range) you can type
./egs -f -c -h hint_1e6_1e11_heuristic_fast.txt 1e6-1e11
which should take a few minutes.
You can compute lower bounds on egs N or egs -f N (this will use a heuristic search for the best bound that can be easily found) or use egs -e N or egs -f -e N to do an exhaustive search for the best bound that the algorithm can prove for the given
$ ./egs 1e6
t(1000000) >= 340790 (heuristic greedy) with (t-ceil(N/3)) = 7456 (0.012s)
$ ./egs -f 1e6
t(1000000) >= 337642 (heuristic fast) with (t-ceil(N/3)) = 4308 (0.003s)
$ ./egs -e 1e6
t(1000000) >= 342303 (exhaustive greedy) with (t-ceil(N/3)) = 8969 (0.272s)
$ ./egs -e -f 1e6
t(1000000) >= 338782 (exhaustive fast) with (t-ceil(N/3)) = 5448 (0.041s)
The following files contain bounds on
-
tbounds_heuristic_greedy_1e4_1e9.txtcontains bounds on$$t(c\cdot 10^n)$$ in the range$$10^4\le 10^9$$ obtained via heuristic search with the greedy algorithm (egs N) -
tbounds_heuristic_fast_1e4_1e14.txtcontains bounds on$$t(c\cdot 10^n)$$ in the range$$10^4\le 10^{14}$$ obtained via heuristic search method with the fast variant of the greedy algorithm (egs -f N) -
tbounds_exhaustive_greedy_1e4_1e9.txtcontains bounds on$$t(c\cdot 10^n)$$ in the range$$10^4\le 10^9$$ obtained via exhaustive search with the greedy algorithm (egs -e N) -
tbounds_exhaustive_fast_1e4_1e9.txtcontains bounds on$$t(c\cdot 10^n)$$ in the range$$10^4\le 10^9$$ obtained via exhaustive search method with the fast variant of the greedy algorithm (egs -e -f N)
To see all the command line options that are supported, run egs without specifying any arguments:
$ ./egs
Usage: egs [-v level] [-h filename] [-d filename] [-r] [-c] [-e] [-f] N-range [t or t/N ratio]
-v level integer verbosity level -1 to 4 (optional, default is 0)
-h filename hint-file with records N:t (required if range of N is specified)
-d filename output-file to dump factorization to (one factor per line, only valid if t is specified)
-r verify factorization (set automatically if dump is specified)
-c create hint-file rather than reading it (must be specified in combination with -h)
-e use the best t for which the algorithm can prove t(N) >= t (optional)
-f use fast version of greedy algorithm
-m exponent for primecount/primesieve cutoff, must lie in [1/6,1/3]
N-range integer N or range of integers minN-maxN (required, scientific notation supported)
t integer t to use for single N (optional, a good t will be determined if unspecified)
t/N ratio a/b with integers a,b>0 specifying t = ceil(aN/b) (optional, set to 1/3 if unspecified)