E007: Mersenne growth (bits and digits)¶
Tags: number-theory, quantitative-exploration, visualization
See: Valid 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)¶
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 tofigures/.
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¶
make run EXP=e007
or:
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).
Reproduce:
make run EXP=e007
Parameters¶
n_max:
500000stride:
50
Quick reference table¶
n |
digits(M_n) |
bits(M_n) |
|---|---|---|
1 |
1 |
1 |
2 |
1 |
2 |
3 |
1 |
3 |
5 |
2 |
5 |
10 |
4 |
10 |
100 |
31 |
100 |
1000 |
302 |
1000 |
10000 |
3011 |
10000 |
Notes¶
For n ≥ 1, the bit-length of M_n is exactly n.
digits(M_n) can be computed via floor(n·log10(2)) + 1 without building M_n.
params.json (snapshot)
{
"n_max": 500000,
"stride": 50
}
References¶
See References.