# E007: Mersenne growth (bits and digits) ```{figure} ../_static/experiments/e007_hero.png :width: 80% :alt: Preview figure for E007 ``` ```{figure} ../_static/experiments/e007_hero_2.png :width: 80% :alt: Preview figure for E007 ``` **Tags:** `number-theory`, `quantitative-exploration`, `visualization` See: {doc}`../tags`. ## Highlights - Visualize how quickly $M_n = 2^n - 1$ grows in **bits** and **decimal digits**. - Compute size metrics *without* constructing huge integers. - Provide simple rules-of-thumb for choosing feasible bounds in later experiments. ## Goal Quantify and visualize the growth of Mersenne numbers $M_n = 2^n - 1$ as $n$ increases. This experiment focuses on **size** (bit-length and decimal digits), because it determines what later algorithms (Lucas–Lehmer, sieving) can realistically handle on a laptop. ## Background (quick refresher) - {doc}`../background/mersenne-primes` ## Research question How fast does the size of $M_n$ grow with $n$, and what simple formulas approximate: - the number of bits of $M_n$ - the number of decimal digits of $M_n$ ## Why this qualifies as a mathematical experiment - **Finite procedure:** evaluate size formulas on a range $n = 1..N$. - **Observable(s):** bit-length and digit count as functions of $n$. - **Parameter space:** vary $N$ (and optional sampling density). - **Outcome:** visual evidence (curves) and tables usable as planning guidance. - **Reproducibility:** parameters written to `params.json`; figures written to `figures/`. ## Experiment design ### Computation Key facts: - $\mathrm{bits}(2^n - 1) = n$ for $n \ge 1$. - $\mathrm{digits}(2^n - 1) = \left\lfloor n\log_{10}(2) \right\rfloor + 1$ for $n \ge 1$. Compute both for a grid of $n$ values. ### Outputs - plot: $n$ vs. bits - plot: $n$ vs. digits - table: selected $n$ with digits (e.g., 10, 100, 1k, 10k, ...) ## How to run ```bash make run EXP=e007 ``` or: ```bash uv run python -m mathxlab.experiments.e007 ``` ## Notes / pitfalls - Avoid converting huge $M_n$ to decimal just to count digits. The logarithm formula is exact for the digit count. - For very large $n$, use stable floating-point evaluation for $n\log_{10}(2)$ (double precision is fine up to very large $n$). - This experiment is intentionally lightweight; it should run quickly. ## Extensions - Overlay “feasibility bands” (e.g., digits thresholds) for what your other experiments can handle. - Compare $M_n$ to other fast-growing families (factorials, primorials) on a log scale. ## Published run snapshot If this experiment is included in the docs gallery, include the published snapshot (report + params). ```{include} ../reports/e007.md :start-after: "" :end-before: "" ``` ::: {dropdown} params.json (snapshot) :open: ```{literalinclude} ../params/e007.json :language: json ``` ::: ## References See {doc}`../references`. {cite:p}`WikipediaContributors2025MersennePrime` ## Related experiments - {doc}`e002` (Even Perfect Numbers — Generator and Growth) - {doc}`e009` (Small-factor scan for Mersenne numbers) - {doc}`e010` (Even perfect numbers from Mersenne primes) - {doc}`e011` (Heuristic rarity of Mersenne primes) - {doc}`e084` (E084: |ζ(1/2+it)| growth snapshots)