"""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 the rows 4 and 5 can never be sums of three cubes (faint). Every other k below 114 has a known representation, since 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 colour. The cube residues are checked here, and the known triple for 3 is checked to sum to 3.""" from pathlib import Path import kit cubes = {x ** 3 % 9 for x in range(9)} sums = {(a + b + c) % 9 for a in cubes for b in cubes for c in cubes} assert cubes == {0, 1, 8} and set(range(9)) - sums == {4, 5} assert 569936821221962380720 ** 3 + (-569936821113563493509) ** 3 + (-472715493453327032) ** 3 == 3 # README, Task B assert 114 % 9 == 6 x0, dx, y0, dy = 62, 43, 26, 27.5 body = '' for k in range(1, 115): x, y = x0 + dx * (k // 9), y0 + dy * (k % 9) if k % 9 in (4, 5): body += kit.circle(x, y, 5, 'faint') elif k == 114: body += kit.dot(x, y, 11, 'f') else: body += kit.dot(x, y, 8, 'sand' if k in (33, 42) else 'ink') kit.write(__file__, 'mathematics', body, label='1 to 114, one row per k mod 9 ยท 114 is open')