# Mills' constant

In number theory, Mills' constant is defined as the smallest positive real number A such that the floor function of the double exponential function
    $\left\lfloor A^{3^{n}}\right\rfloor$
is a prime number for all positive natural numbers n. This constant is named after William Harold Mills who proved in 1947 the existence of A based on results of Guido Hoheisel and Albert Ingham on the prime gaps. Its value is unproven, but if the Riemann hypothesis is true, it is approximately 1.3063778838630806904686144926... (sequence A051021 in the OEIS).

## Mills primes

The primes generated by Mills' constant are known as Mills primes; if the Riemann hypothesis is true, the sequence begins
    $2,11,1361,2521008887,16022236204009818131831320183,$
    $4113101149215104800030529537915953170486139623539759933135949994882770404074832568499,\ldots$ (sequence A051254 in the OEIS).
If a$_i$ denotes the i th prime in this sequence, then a$_i$ can be calculated as the smallest prime number larger than $a_{i-1}^{3}$. In order to ensure that rounding $A^{3^{n}}$, for n = 1, 2, 3, ..., produces this sequence of primes, it must be the case that $a_{i}<(a_{i-1}+1)^{3}$. The Hoheisel–Ingham results guarantee that there exists a prime between any two sufficiently large cube numbers, which is sufficient to prove this inequality if we start from a sufficiently large first prime $a_{1}$. The Riemann hypothesis implies that there exists a prime between any two consecutive cubes, allowing the sufficiently large condition to be removed, and allowing the sequence of Mills primes to begin at a$_1$ = 2.
For all a > $e^{e^{34}}$, there is at least one prime between $a^{3}$ and $(a+1)^{3}$. This upper bound is much too large to be practical, as it is infeasible to check every number below that figure. However, the value of Mills' constant can be verified by calculating the first prime in the sequence that is greater than that figure.
As of April 2017, the 11th number in the sequence is the largest one that has been proved prime. It is
    $\displaystyle (((((((((2^{3}+3)^{3}+30)^{3}+6)^{3}+80)^{3}+12)^{3}+450)^{3}+894)^{3}+3636)^{3}+70756)^{3}+97220$
and has 20562 digits.
As of 2024, the largest known Mills probable prime (under the Riemann hypothesis) is
    $\displaystyle (((((((((((((2^{3}+3)^{3}+30)^{3}+6)^{3}+80)^{3}+12)^{3}+450)^{3}+894)^{3}+3636)^{3}+70756)^{3}+97220)^{3}+66768)^{3}+300840)^{3}+1623568)^{3}+8436308$
(sequence A108739 in the OEIS), which is 1,665,461 digits long.

## Numerical calculation

By calculating the sequence of Mills primes, one can approximate Mills' constant as
    $A\approx a(n)^{1/3^{n}}.$
Caldwell and Cheng used this method to compute 6850 base 10 digits of Mills' constant under the assumption that the Riemann hypothesis is true. There is no closed-form formula known for Mills' constant, and it is not even known whether this number is rational.

## Generalisations

There is nothing special about the middle exponent value of 3. It is possible to produce similar prime-generating functions for different middle exponent values. In fact, for any real number above 2.106..., it is possible to find a different constant A that will work with this middle exponent to always produce primes. Moreover, if Legendre's conjecture is true, the middle exponent can be replaced with value 2 (sequence A059784 in the OEIS).
Matomäki showed unconditionally (without assuming Legendre's conjecture) the existence of a (possibly large) constant A such that $\lfloor A^{2^{n}}\rfloor$ is prime for all n.
Additionally, Tóth proved that the floor function in the formula could be replaced with the ceiling function, so that there exists a constant $B$ such that
    $\lceil B^{r^{n}}\rceil$
is also prime-representing for $r>2.106\ldots$. In the case $r=3$, the value of the constant $B$ begins with 1.24055470525201424067... The first few primes generated are:
    $2,7,337,38272739,56062005704198360319209,176199995814327287356671209104585864397055039072110696028654438846269,\ldots$
Without assuming the Riemann hypothesis, Elsholtz proved that $\lfloor A^{10^{10n}}\rfloor$ is prime for all positive integers n, where $A\approx 1.00536773279814724017$, and that $\lfloor B^{3^{13n}}\rfloor$ is prime for all positive integers n, where $B\approx 3.8249998073439146171615551375$.