# E129: Euler lucky constants for $n^2 + n + b$ ```{figure} ../_static/experiments/e129_hero.png :width: 80% :alt: Preview figure for E129 ``` ```{figure} ../_static/experiments/e129_hero_2.png :width: 80% :alt: Preview figure for E129 ``` **Tags:** `number-theory`, `quantitative-exploration`, `visualization`, `primes`, `heuristics` See: {doc}`../tags`. ## Highlights - Compares several classical “lucky” constants $b$ side-by-side. - Heatmap shows prime/composite patterns across $n$ for each $b$. - Report includes the first failure $n$ and a factorization witness. ## Goal Compare how long $n^2+n+b$ stays prime at the start for a small set of classical constants $b$. We quantify the initial prime streak length and visualize where it breaks. ## Background (quick refresher) - {doc}`../background/eulers-prime-generating-polynomial` - {doc}`../background/quadratic-polynomials` - {doc}`../background/prime-numbers` ## Research question Among a short list of traditional “Euler lucky numbers” $b$, which yields the longest initial prime streak for $f(n)=n^2+n+b$ and how do the failures look (first composite and its factors)? ## Method - Choose a list of constants $b$. - For each $b$, evaluate $f(n)$ for $n=0..N$. - Use a sieve to classify values as prime/composite and measure the initial run length. - Visualize a prime indicator map and a bar chart of run lengths. ## How to run ```bash make run EXP=e129 ``` or: ```bash uv run python -m mathxlab.experiments.e129 ``` ## Outputs This experiment follows the standard output contract: - `out/e129/figures/` — generated figures (PNG) - `out/e129/report.md` — short narrative report - `out/e129/params.json` — run parameters (stable JSON) - `out/e129/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/e129.md :start-after: "" :end-before: "" ``` ::: {dropdown} params.json (snapshot) :open: ```{literalinclude} ../params/e129.json :language: json ``` ::: ## References - Lucky numbers and Euler’s polynomial: {cite:t}`WikipediaContributors2025LuckyNumbersOfEuler`, {cite:t}`Weisstein2025EulerPrimeMathWorld`. ## Related experiments - {doc}`e013` (Euler’s $n^2+n+41$ counterexample witness) - {doc}`e127` (full (a,b) atlas for $n^2+an+b$) - {doc}`e128` (modular obstructions that force failures) - {doc}`e019` (prime density and “random prime” heuristics)