An optimized C++ solver designed to find the minimum span (
The algorithm at any given depth calculates the minimum possible distance required to place the remaining
If the current value plus this minimum distance exceeds the best if (last_val + min_span_remaining >= g_best_alpha) return;
Pairwise differences are tracked using two 128-bit registers:
seen_once: Bits are toggled when a difference is encountered for the first time.seen_twice: Bits are toggled when a difference is encountered for the second time. If a new candidate number generates a difference already present inseen_twice, it is rejected in a single clock cycle.
For maximum performance, always compile with the -O3 flag:
0, 1, 2, 4, 6, 9, 13, 18, 23, 29, 36, 44, 53, 63
n | α
10 | 29
11 | 36
12 | 44
13 | 53
14 | 63
15 | 74
16 | 84
- SolverV2 - Updated Algorithm that only checks sets of form [1,2...α]
- SolverComplete - Algorithm that checks all sets of form [1,...α]
- SolverMultiThreaded- Algorithm that checks all sets of form [1,...α] using multi threading