# E003: Abundancy Index Landscape ```{figure} ../_static/experiments/e003_hero.png :width: 80% :alt: Preview figure for E003 ``` ```{figure} ../_static/experiments/e003_hero_2.png :width: 80% :alt: Preview figure for E003 ``` ```{figure} ../_static/experiments/e003_hero_3.png :width: 80% :alt: Preview figure for E003 ``` **Tags:** `number-theory`, `quantitative-exploration`, `visualization`, `numerics` See: {doc}`../tags`. ## Highlights - Compute $\sigma(1..N)$ via a divisor-sum sieve. - Visualize the distribution of $I(n)=\sigma(n)/n$. - Highlight perfect numbers as the razor-thin level set $I(n)=2$. ## Goal Visualize how **rare** perfect numbers are by plotting the distribution of the **abundancy index** $$ I(n) = \frac{\sigma(n)}{n} $$ for integers $n \le N$. Perfect numbers satisfy $I(n)=2$. ## Research question For a given bound $N$: - What does the empirical distribution of $I(n)$ look like? - How frequently do we see values near $2$? - Where do the perfect numbers appear in the landscape? ## Why this qualifies as a mathematical experiment The divisor-sum function $\sigma(n)$ is highly structured but “spiky” and hard to intuit symbolically. Computational sweeps reveal qualitative structure (clusters, gaps, tails) and put perfect numbers into context. ## Experiment design ### Method: compute $\sigma(1)$, …, $\sigma(N)$ via a divisor-sum sieve Use the identity “each divisor contributes to its multiples”: - initialize an array `sigma[0..N]` with zeros - for each `d = 1..N`: - add `d` to `sigma[k]` for all multiples `k = d, 2d, 3d, ...` This runs in about $O(N\log N)$ time and avoids per-number factorization. ### Observables - $I(n) = \sigma(n)/n$ - distance to perfection: $|I(n)-2|$ - classification: - deficient: $I(n)<2$ - perfect: $I(n)=2$ - abundant: $I(n)>2$ ### Plots - histogram of $I(n)$ (or of $I(n)-1$) - scatter plot of $n$ vs. $I(n)$ (optionally with log-scale on $n$) - highlight perfect numbers ## How to run ```bash make run EXP=e003 ``` or: ```bash uv run python -m mathxlab.experiments.e003 ``` ## Notes / pitfalls - $I(n)$ is rational. For classification, compare integers using $\sigma(n)$ and $2n$ rather than floats. - For plots, floats are fine, but compute the “perfect” condition as `sigma[n] == 2*n`. - Start with $N \le 1\,000\,000$ to keep runtime and memory reasonable. ## Extensions - Repeat for different ranges and overlay histograms. - Plot the top-$k$ values of $I(n)$ and compare to known extremal families. - Explore the “near misses” set (feeds directly into E006). ## Published run snapshot If this experiment is included in the docs gallery, include the published snapshot (report + params). ```{include} ../reports/e003.md :start-after: "" :end-before: "" ``` ::: {dropdown} params.json (snapshot) :open: ```{literalinclude} ../params/e003.json :language: json ``` ::: ## References See {doc}`../references`. {cite:p}`Weisstein2003PerfectNumberMathWorld,OEIS2025A000396PerfectNumbers,Voight1998PerfectNumbersElementaryIntroduction` ## Related experiments - {doc}`e002` (Even Perfect Numbers — Generator and Growth) - {doc}`e052` (Totient ratio landscape) - {doc}`e059` (Abundancy index landscape) - {doc}`e094` (E094: ω(n) vs. Ω(n): Erdős–Kac normalization) - {doc}`e097` (E097: σ(n)/n landscape: deficient, perfect, abundant)