# E128: Quadratic modular obstructions (Euler-type) ```{figure} ../_static/experiments/e128_hero.png :width: 80% :alt: Preview figure for E128 ``` **Tags:** `number-theory`, `model-checking`, `counterexample-search`, `primes` See: {doc}`../tags`. ## Highlights - Makes the “hidden reason” a prime streak must fail: modular obstructions. - Lists explicit residue classes $n\bmod p$ that force divisibility of $f(n)$. - Includes the classic witness $n=41k$ for Euler’s $n^2+n+41$. ## Goal Show how congruences explain why a “prime-generating polynomial” cannot stay prime forever. For each small prime modulus $p$, we compute the roots of $f(n)\equiv 0\pmod p$. ## Background (quick refresher) - {doc}`../background/eulers-prime-generating-polynomial` - {doc}`../background/quadratic-polynomials` - {doc}`../background/prime-numbers` ## Research question For Euler’s $f(n)=n^2+n+41$, which small primes $p$ divide some values $f(n)$, and which residue classes $n\bmod p$ generate those guaranteed composites? ## Method - Fix $f(n)=n^2+an+b$ with $(a,b)=(1,41)$. - For each prime $p\le p_{\max}$, brute-force all residues $n\in\{0,\dots,p-1\}$ and record solutions to $f(n)\equiv 0\pmod p$. - Plot the number of roots per prime and write a report table of residues. ## How to run ```bash make run EXP=e128 ``` or: ```bash uv run python -m mathxlab.experiments.e128 ``` ## Outputs This experiment follows the standard output contract: - `out/e128/figures/` — generated figures (PNG) - `out/e128/report.md` — short narrative report - `out/e128/params.json` — run parameters (stable JSON) - `out/e128/logs/` — run logs (created by the runner/Makefile) ## Published run snapshot If this experiment is included in the docs gallery, include the published snapshot (report + params). ```{include} ../reports/e128.md :start-after: "" :end-before: "" ``` ::: {dropdown} params.json (snapshot) :open: ```{literalinclude} ../params/e128.json :language: json ``` ::: ## References - Euler’s quadratic and its folklore: {cite:t}`WikipediaContributors2025LuckyNumbersOfEuler`, {cite:t}`Weisstein2025EulerPrimeMathWorld`. - Quadratic basics: {cite:t}`WikipediaContributors2026QuadraticEquation`. ## Related experiments - {doc}`e013` (first explicit counterexample $f(40)=41^2$) - {doc}`e031` (admissibility / modular obstructions in prime constellations) - {doc}`e035` (primes in arithmetic progressions) - {doc}`e038` (Bertrand’s postulate: primes in intervals)