Sums of three cubes: 114, and a fourth way to write 3
Write 114, the smallest open case, as a sum of three integer cubes, or find a fourth representation of 3 as a sum of three cubes.

| 1 | """Every k from 1 to 114, nine to a column so that each row is one residue of k mod 9. Cubes are 0 or +-1 mod 9, so |
| 2 | the rows 4 and 5 can never be sums of three cubes (faint). Every other k below 114 has a known representation, since |
| 3 | 114 is the smallest open case (README); 33 and 42, the last two found, in 2019, are in sand, and 114 in the field's |
| 4 | colour. The cube residues are checked here, and the known triple for 3 is checked to sum to 3.""" |
| 5 | from pathlib import Path |
| 6 | |
| 7 | import kit |
| 8 | |
| 9 | cubes = {x ** 3 % 9 for x in range(9)} |
| 10 | sums = {(a + b + c) % 9 for a in cubes for b in cubes for c in cubes} |
| 11 | assert cubes == {0, 1, 8} and set(range(9)) - sums == {4, 5} |
| 12 | assert 569936821221962380720 ** 3 + (-569936821113563493509) ** 3 + (-472715493453327032) ** 3 == 3 # README, Task B |
| 13 | assert 114 % 9 == 6 |
| 14 | |
| 15 | x0, dx, y0, dy = 62, 43, 26, 27.5 |
| 16 | body = '' |
| 17 | for k in range(1, 115): |
| 18 | x, y = x0 + dx * (k // 9), y0 + dy * (k % 9) |
| 19 | if k % 9 in (4, 5): |
| 20 | body += kit.circle(x, y, 5, 'faint') |
| 21 | elif k == 114: |
| 22 | body += kit.dot(x, y, 11, 'f') |
| 23 | else: |
| 24 | body += kit.dot(x, y, 8, 'sand' if k in (33, 42) else 'ink') |
| 25 | kit.write(__file__, 'mathematics', body, label='1 to 114, one row per k mod 9 · 114 is open') |