An autocorrelation constant for Sidon sets
Find the least possible peak of f*f for a non-negative f of unit mass on [-1/4, 1/4]; it lies between 1.2802 and 1.50286.
| 1 | """The autoconvolution f*f of the current verified record, Together AI's 30,000-step function (README: "a step function |
| 2 | published by Together AI in 2026, recorded on the source as 1.502862"), with int f = 1. Optimising pushes the peak of |
| 3 | f*f down until about a third of it presses flat against one ceiling: that ceiling is the bound. |
| 4 | |
| 5 | The record is 700 kB, so record.json keeps what the figure needs, made from it exactly by |
| 6 | |
| 7 | python3 figure.py --reduce ours_2026.json |
| 8 | |
| 9 | with ours_2026.json from https://github.com/togethercomputer/EinsteinArena-new-SOTA/blob/main/first-autocorrelation/solutions/ours_2026.json |
| 10 | f*f is computed in exact integer arithmetic, as checks/judge does; record.json keeps f*f / (int f)^2 at 1201 evenly |
| 11 | spaced breakpoints (to 6 decimals) and the exact peak over all 60,001 breakpoints, rounded up to 12 decimals.""" |
| 12 | import json |
| 13 | import sys |
| 14 | from fractions import Fraction |
| 15 | from math import gcd |
| 16 | from pathlib import Path |
| 17 | |
| 18 | import kit |
| 19 | |
| 20 | DATA = Path(__file__).resolve().parent / 'record.json' |
| 21 | SAMPLES = 1200 |
| 22 | |
| 23 | |
| 24 | def reduce(src): |
| 25 | hs = [Fraction(v) for v in json.loads(Path(src).read_text())['values']] |
| 26 | q = 1 |
| 27 | for x in hs: |
| 28 | q = q * x.denominator // gcd(q, x.denominator) |
| 29 | a = [x.numerator * (q // x.denominator) for x in hs] |
| 30 | n, total = len(a), sum(a) |
| 31 | w = (2 * max(a).bit_length() + n.bit_length()) // 8 + 1 # Kronecker substitution, as in checks/judge |
| 32 | y = (int.from_bytes(b''.join(v.to_bytes(w, 'little') for v in a), 'little') ** 2).to_bytes(w * (2 * n - 1), 'little') |
| 33 | c = [0] + [int.from_bytes(y[k * w:(k + 1) * w], 'little') for k in range(2 * n - 1)] + [0] # f*f at t = -1/2 + k/(2n) |
| 34 | peak = Fraction(2 * n * max(c), total * total) |
| 35 | assert (2 * n) % SAMPLES == 0 |
| 36 | DATA.write_text(json.dumps({ |
| 37 | 'source': 'https://github.com/togethercomputer/EinsteinArena-new-SOTA/blob/main/first-autocorrelation/solutions/ours_2026.json', |
| 38 | 'steps': n, |
| 39 | 'peak': str(-(-peak.numerator * 10 ** 12 // peak.denominator) / 10 ** 12), |
| 40 | 'ff': [round(2 * n * c[k] / total ** 2, 6) for k in range(0, 2 * n + 1, 2 * n // SAMPLES)], |
| 41 | }) + '\n') |
| 42 | |
| 43 | |
| 44 | if sys.argv[1:2] == ['--reduce']: |
| 45 | reduce(sys.argv[2]) |
| 46 | |
| 47 | rec = json.loads(DATA.read_text()) |
| 48 | peak, ff = float(rec['peak']), rec['ff'] |
| 49 | assert rec['peak'].startswith('1.502862') # the README's record |
| 50 | assert abs(max(ff) - peak) < 2e-6 and abs(sum(ff[1:-1]) / SAMPLES - 1) < 1e-3 # the samples reach the peak; int f*f = 1 |
| 51 | |
| 52 | x0, x1, base, top = 24, 616, 252, 60 # t from -1/2 to 1/2; the peak at the top |
| 53 | curve = [(x0 + (x1 - x0) * j / SAMPLES, base - (base - top) * v / peak) for j, v in enumerate(ff)] |
| 54 | body = kit.polygon([(x0, base)] + curve + [(x1, base)], 'ink', ' fill-opacity=".28"') # a silhouette: f*f swings fast |
| 55 | body += kit.line(x0, top, x1, top, 'f-s', 3) # the peak, where the record presses f*f flat |
| 56 | kit.write(__file__, 'mathematics', body, label=f'f∗f of the record f, flat at its peak {rec["peak"][:8]}') |
