# E002: Even Perfect Numbers — Generator and Growth ```{figure} ../_static/experiments/e002_hero.png :width: 80% :alt: Preview figure for E002 ``` ```{figure} ../_static/experiments/e002_hero_2.png :width: 80% :alt: Preview figure for E002 ``` ```{figure} ../_static/experiments/e002_hero_3.png :width: 80% :alt: Preview figure for E002 ``` **Tags:** `number-theory`, `quantitative-exploration`, `visualization`, `numerics` See: {doc}`../tags`. ## Highlights - Generate even perfect numbers from known Mersenne exponents $p$. - Plot digits and bit-length growth vs. $p$. - Test the approximation $\log_{10}(N(p)) \approx 2p\log_{10}(2)$. ## Goal Generate **even perfect numbers** from known Mersenne prime exponents $p$ and visualize how fast the numbers grow. Measure growth via **digit count**, **bit length**, and simple logarithmic approximations. ## Research question For $$ N(p) = 2^{p-1}(2^p-1), $$ how do: - $\mathrm{digits}(N)$, - $\mathrm{bit\_length}(N)$, - $\log_{10}(N)$ scale with the exponent $p$? How accurate is the approximation $$ \log_{10}(N(p)) \approx 2p\log_{10}(2)? $$ ## Why this qualifies as a mathematical experiment The Euclid–Euler theorem tells us exactly what even perfect numbers look like, but it does not directly convey how quickly the objects become astronomically large. This experiment uses computation and visualization to build quantitative intuition and test simple asymptotic approximations. ## Experiment design ### Inputs - A curated list of known Mersenne prime exponents, e.g. $p \in \{2,3,5,7,13,17,19,31,\dots\}$. ### Observables For each exponent $p$: - $N(p)$ as a Python integer - $\mathrm{digits}(N(p))$ - $\mathrm{bit\_length}(N(p))$ - approximation error: $$ \Delta(p) = \log_{10}(N(p)) - 2p\log_{10}(2) $$ ### Plots - $p$ vs. digits - $p$ vs. bit length - $p$ vs. $\Delta(p)$ ## How to run From the repo root: ```bash make run EXP=e002 ``` or: ```bash uv run python -m mathxlab.experiments.e002 ``` ## Notes / pitfalls - Avoid converting huge integers to decimal strings repeatedly in tight loops; compute digits using logs where possible. - Use `int.bit_length()` for stable bit length (fast and exact). - Keep the exponent list modest for fast docs builds; this is a growth experiment, not a search for new Mersenne primes. ## Extensions - Compare growth to $2^{2p}$ and quantify the relative gap. - Add a “human scale” axis: compare $\mathrm{digits}(N(p))$ to common benchmarks (atoms in the observable universe, etc.). - Pull the exponent list from a small data file so the experiment can be updated without code changes. ## Published run snapshot If this experiment is included in the docs gallery, include the published snapshot (report + params). ```{include} ../reports/e002.md :start-after: "" :end-before: "" ``` ::: {dropdown} params.json (snapshot) :open: ```{literalinclude} ../params/e002.json :language: json ``` ::: ## References See {doc}`../references`. {cite:p}`Caldwell2000EvenPerfectNumbersPrimePages,OEIS2025A000396PerfectNumbers,Voight1998PerfectNumbersElementaryIntroduction` ## Related experiments - {doc}`e005` (Odd Perfect Numbers — Constraint Filter Pipeline) - {doc}`e007` (Mersenne growth (bits and digits)) - {doc}`e010` (Even perfect numbers from Mersenne primes) - {doc}`e084` (E084: |ζ(1/2+it)| growth snapshots) - {doc}`e097` (E097: σ(n)/n landscape: deficient, perfect, abundant)