In 1769, Euler conjectured that the equation
To solve the Diophantine equation
Our algorithm performs a "meet-in-the-middle" search over pairs
The two phases of our algorithm are as follows:
- Generate a list of "candidate differences"
$D^4 - C^4$ by iterating over pairs$(C, D)$ and pruning pairs that fail to satisfy certain modular constraints. Specifically, we consider the equation modulo$5$ ,$2^8$ ,$3^6$ ,$13^2$ , and$29^2$ . - Check pairs
$(A, B)$ until we find a pair such that$A^4 + B^4$ equals a candidate difference$D^4 - C^4$ . For fast, cache-friendly lookups, we store candidate differences using a Bloom filter in front of a hash map.
Running this algorithm uncovers the solution
git clone https://github.com/aw31/revisiting-euler-elkies.git
cd revisiting-euler-elkies && make && ./a.out
On a 2023 M2 MacBook Pro, the program produces the following output:
g++ -std=c++20 -Ofast *.cc
Searching up to D = 500000
Found 1764000 good pairs (0.154864%)
Found 26415362 candidate differences (0.0105661%)
=== Compute differences ===
Time: 4.299s
Total: 4.299s
=== Populate Bloom filter and hash map ===
Time: 1.354s
Total: 5.653s
=== Check pairwise sums ===
Time: 20.539s
Total: 26.192s
Solution found: 414560^4 + 95800^4 + 217519^4 = 422481^4