Unit circles through three of n points
Show that n points in the plane have only o(n²) unit circles passing through three of them; the best construction gives n^{3/2}.

| 1 | --- |
| 2 | issue: 5 |
| 3 | status: working |
| 4 | --- |
| 5 | |
| 6 | # Independent reproduction of the PR #4 verifier |
| 7 | |
| 8 | Issue #5 asks for one thing: reproduce the result of pull request #4 with code of |
| 9 | my own, then report in a review there. This route does that. The artifact is |
| 10 | branch `origin/rusirui-rational-verifier` at `73e7e69`, folder |
| 11 | `routes/rusirui-rational-verifier/`; I checked it out in a separate worktree and |
| 12 | never modified it. |
| 13 | |
| 14 | **Verdict: every claim the artifact makes about itself held on this machine.** Its |
| 15 | five test methods pass; the CLI gives the documented exit codes and the |
| 16 | documented output; the output is byte-identical to `example-verification.json`; |
| 17 | the six reject fixtures fail and leave no file; the 80-point grid counts 76 in |
| 18 | about a second. Independently written counters agree with it on 138 |
| 19 | configurations. Nothing I found blocks merging #4. |
| 20 | |
| 21 | This is a reproduction of a verifier, not of the problem: it says nothing about |
| 22 | whether u(A) = o(n²), and no Shoal check exists to judge either (the root |
| 23 | `scienceslack.json` has no `checks`, and `GET .../branches/rusirui-repro-verifier` |
| 24 | reports none), so this route's finding is a peer reproduction, not a verdict. |
| 25 | |
| 26 | ## What I ran on the artifact, and what it said |
| 27 | |
| 28 | Windows 11, Python 3.13.13, Git's POSIX shell, 2026-11-28. Every number below is |
| 29 | from a run in this session, not from the artifact's notes. |
| 30 | |
| 31 | | claim in the artifact's README | what I observed | |
| 32 | | --- | --- | |
| 33 | | `test_verify.py` passes five methods incl. 60 oracle comparisons | `Ran 5 tests in 0.478s`, `OK`; the five are `test_samples`, `test_independent_oracle`, `test_symmetries_and_witnesses`, `test_cli`, `test_limits`; the oracle loop really is `range(60)` and does not reuse the circumcentre code (side-length/area radius identity + a concyclicity determinant) | |
| 34 | | `verify.py` on the route folder → PASS n=9, 5 circles, output identical to `example-verification.json` | exit 0; `PASS: configuration.json: n=9, exact unit circles=5`; output identical **as bytes**, not only as parsed JSON | |
| 35 | | each of the six `samples/reject` fixtures → exit 1, no `verification.json` left | all six exit 1 and leave no output, including when a stale output file was planted first; the four with a wrong count are refused with `collinear` 1→0, `nearly-unit` 1→0, `overcount` 4→1, `undercount` 0→1; `duplicate` and `float` are refused as invalid input | |
| 36 | | the six `samples/accept` fixtures pass | exit 0 with counts 0, 1, 5, 0, 1, 1 as claimed | |
| 37 | | 80-point grid → 76 circles, promptly | 76 circles, 0.94 s; by hand, lattice centres give 8·6 interior + 6+6 on the vertical edges + 8+8 on the horizontal ones = 76, and the exact enumeration finds no non-lattice centre | |
| 38 | |
| 39 | `ops_probe.py` in this route is the harness: 40 checks, all matched. Besides the |
| 40 | table above it covers exit 2 for a nonexistent route folder and for |
| 41 | `--output` equal to the input (leaving the input intact), `SKIP` on a missing |
| 42 | `configuration.json` with no file emitted, duplicate JSON keys, invalid UTF-8, |
| 43 | `configuration.json` as a directory, 81 points, a 33-digit coordinate, a file |
| 44 | over 128 KiB, a count above the pair bound, and `check.sbatch` itself under |
| 45 | Git's POSIX shell (it resolves `verify.py` beside itself, writes |
| 46 | `verification.json` in the job's cwd, and passes a wrong-count rejection |
| 47 | through). One probe is **not** exercised: the symlinked-`configuration.json` |
| 48 | guard, because this Windows account cannot create symlinks. A route directory |
| 49 | that is itself a symlink or junction is not guarded at all. |
| 50 | |
| 51 | ### Worst-case cost at the input caps |
| 52 | |
| 53 | The proposed runner allows `--time=00:02:00` and `--mem=256M`. At n = 80: |
| 54 | |
| 55 | | input | count | wall time | peak RSS | |
| 56 | | --- | --- | --- | --- | |
| 57 | | 10×8 grid | 76 | 0.94 s | 17.6 MB | |
| 58 | | 80 points on one unit circle | 1 | 1.27 s | 17.7 MB | |
| 59 | | 80 random small integers | 0 | 1.00 s | 17.4 MB | |
| 60 | | 80 random 32-digit integers | 0 | 1.69 s | 17.5 MB | |
| 61 | | 80 random 32-digit fractions | 0 | 9.24 s | 17.4 MB | |
| 62 | |
| 63 | The last case is ten times the README's 0.9 s figure and is the one a hostile |
| 64 | submitter would send, but it is still an order of magnitude inside both limits. |
| 65 | |
| 66 | ## Code of my own, and how it was checked |
| 67 | |
| 68 | Three counters, each written from the problem statement with the artifact's |
| 69 | source off limits, each a different algorithm: |
| 70 | |
| 71 | - `repro.py` — chord construction, O(n²) pairs. A centre on the perpendicular |
| 72 | bisector is `m + s·v'`; the radius condition forces |
| 73 | `s² = (4 − d2)/(4·d2)`, so a pair yields rational centres exactly when that |
| 74 | ratio is a rational square (or `d2 = 4`, giving the midpoint). |
| 75 | - `panel/impl-triples/count.py` — triple enumeration with `fractions.Fraction`, |
| 76 | Cramer's rule on `2u·d = |u|²`, `2v·d = |v|²`, dedup by exact centre. |
| 77 | - `panel/impl-integer/count.py` — integer arithmetic only, no `Fraction`: all |
| 78 | points over one denominator `L`, centre as a canonical reduced triple, |
| 79 | radius test `P² + Q² = 4D²L²`, incidences recounted with integers. |
| 80 | |
| 81 | `compare.py` requires every counter to report the same n, the same number of |
| 82 | circles and the same set of exact centres (compared as `Fraction`s, not |
| 83 | strings), and to reject every invalid input with exit 1 and empty stdout. The |
| 84 | corpus is `make_corpus.py`: 138 valid cases — 17 structured, 120 fixed-seed |
| 85 | random over small rationals, one 10×8 grid — and 12 invalid inputs, plus one |
| 86 | claim-contract case the artifact alone must reject (a counter ignores the |
| 87 | claimed count, by design). |
| 88 | |
| 89 | Result: **138/138 valid cases agree** across `repro.py`, both panel counters and |
| 90 | the artifact's own `unit_centers` (imported and used as a fifth opinion), with |
| 91 | every centre compared exactly; all 12 invalid inputs are rejected by all three |
| 92 | counters; the claim-contract case is rejected by the artifact. Counts for the |
| 93 | structured cases were derived by hand, not by code: three, five, eight and ten |
| 94 | points on a unit circle → 1; five points on a circle of radius 2 or 3 → 0; a |
| 95 | collinear set → 0; the 3×3 grid → 5; the 10×8 grid → 76; four concyclic points |
| 96 | plus one off the circle → 1; three points on a unit circle with centre |
| 97 | (1/3, 2/7) → 1; a triangle with circumradius √5/2 → 0; and two unit circles at |
| 98 | centres (0,0) and (6/5,0) meeting at (3/5, ±4/5), plus (1,0) and (11/5,0) → 4, |
| 99 | not 2: the mixed triples also lie on the unit circles centred (8/5, ±4/5). |
| 100 | |
| 101 | That last case and one other were errors **in my own work**, caught by the |
| 102 | harness: I first expected 2 there, and my first `repro.py` required the chord |
| 103 | and the perpendicular height each to be rational, which rejects `(1,0)` and |
| 104 | `(0,1)` although their centres are `(0,0)` and `(1,1)`. Only the ratio is |
| 105 | rational; `three-on-unit-circle` fails immediately under the wrong test. Both |
| 106 | are recorded because a reproduction that never found a mistake in itself is |
| 107 | usually not looking hard enough. |
| 108 | |
| 109 | ## The mathematics I re-derived |
| 110 | |
| 111 | - **Completeness for rational input.** The circumcentre of three non-collinear |
| 112 | rational points is rational by Cramer's rule, and a line meets a circle in at |
| 113 | most two points, so three points on a unit circle are never collinear and are |
| 114 | the circumcentre's own triple. No unit circle through three rational points is |
| 115 | lost by working with rational centres only. |
| 116 | - **Soundness.** A retained centre satisfies `2u·d = |u|²` and `2v·d = |v|²`, so |
| 117 | it is equidistant from all three points; testing the radius against one of |
| 118 | them tests all three. |
| 119 | - **Dedup.** A unit circle has exactly one centre, and reduced `Fraction` pairs |
| 120 | compare exactly, so a set of centres counts each circle once however many of |
| 121 | its points are incident — verified on a case with six concyclic points. |
| 122 | - **Pair bound.** Each counted circle carries `C(k,2) ≥ 3` pairs for `k ≥ 3` |
| 123 | incident points, each pair lies on at most two unit circles, so |
| 124 | `3u ≤ 2·C(n,2) = n(n−1)` and `u ≤ n(n−1)/3`; the artifact's use of `n(n−1)//3` |
| 125 | as an input guard is sound. |
| 126 | - **Cited values.** OEIS A003829 read at oeis.org/A003829 on 2026-11-28 gives |
| 127 | `1, 4, 4, 8, 12, 16`, offset 3, "Maximal number of unit circles through n |
| 128 | points in plane, each circle containing 3 of the points" — the artifact's |
| 129 | citation is right. I did not re-derive Elekes' construction or the |
| 130 | Harborth–Mengersen configurations. |
| 131 | |
| 132 | ## Limitations |
| 133 | |
| 134 | - No Shoal check exists for this project, so nothing here carries a check's |
| 135 | verdict; the reproduction is another agent's independent run, which the guide |
| 136 | counts as verification, no more. |
| 137 | - Windows only: the Linux image, the symlink guard and the route-directory |
| 138 | symlink case are untested, and the timing figures are this machine's. |
| 139 | - Rational coordinates only, like the artifact; the problem is stated over the |
| 140 | reals. |
| 141 | - I did not test the input caps' *interaction* (a 128 KiB file full of 32-digit |
| 142 | fractions at n=80), only each cap separately. |
| 143 | |
| 144 | ## Reproduce |
| 145 | |
| 146 | ``` |
| 147 | git worktree add ../pr4-artifact origin/rusirui-rational-verifier |
| 148 | python3 routes/rusirui-repro-verifier/ops_probe.py ../pr4-artifact/routes/rusirui-rational-verifier |
| 149 | python3 routes/rusirui-repro-verifier/make_corpus.py /tmp/corpus |
| 150 | python3 routes/rusirui-repro-verifier/compare.py --corpus /tmp/corpus \ |
| 151 | --artifact ../pr4-artifact/routes/rusirui-rational-verifier \ |
| 152 | routes/rusirui-repro-verifier/repro.py \ |
| 153 | routes/rusirui-repro-verifier/panel/*/count.py |
| 154 | python3 ../pr4-artifact/routes/rusirui-rational-verifier/test_verify.py |
| 155 | ``` |
| 156 | |
| 157 | ## Sources |
| 158 | |
| 159 | - T. F. Bloom, [Erdős Problem 104](https://www.erdosproblems.com/104), accessed |
| 160 | 2026-11-28. Credit to Erdős Problems for the problem statement. |
| 161 | - [OEIS A003829](https://oeis.org/A003829), read 2026-11-28. |
| 162 | - Pull request #4, branch `origin/rusirui-rational-verifier` at `73e7e69`. |
| 163 | |
| 164 | ## Next |
| 165 | |
| 166 | For #4: nothing found that blocks the merge, and the review on the pull request |
| 167 | says so. For the maintainer's activation step, the two things this reproduction |
| 168 | could not check are the run inside `python:3.12-slim` and the symlink guard; both |
| 169 | are one command on a Linux runner. A hostile-submitter probe worth adding is a |
| 170 | route directory that is itself a symlink or junction, which `verify.py` does not |
| 171 | test for. |