Are my calculations of a new constant similar to Mill's constant based on $\lfloor A^{2^{n}}\rfloor$ and Bertrand's postulate correct?

634 Views Asked by At

As Wikipedia explains in number theory, Mills' constant is defined as:

"The smallest positive real number $A$ such that the floor function of the double exponential function $\lfloor A^{3^{n}}\rfloor$ is a prime number, for all natural numbers $n$. This constant is named after William H. 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 unknown, but if the Riemann hypothesis is true, it is approximately $1.3063778838630806904686144926...$ (sequence A051021 in OEIS)."

In other words, $\lfloor A^{3^{n}}\rfloor$ is said to be a prime-representing function, because $f(x)$ is a prime number for all positive integral values of $x$.

The demonstration made by Mills in 1947 (pdf here) is very easy to follow (one must be careful about the already known typos of the paper to follow properly the explanation).

It is also known that generically (as explained in this nice question at MSE) $\lfloor Q^{k^{n}}\rfloor$ always works if $k$ is at least $3$, so there are other constants $Q$ not defined yet that will work when $k$ is greater than $3$. It is also known that $k=2$ might not work because it depends on the Legendre's conjecture: is there always a prime between $N^2$ and $(N+1)^2$ (thought to be extremely difficult to demonstrate).

The reason of this question is that based on the original demonstration and using the Bertrand's postulate as key for some manipulations, I tried to do my own version of the Mill's constant to learn, and it seems that was able to find a constant $L$ that for $\lfloor L^{2^{n}}\rfloor$ provides a sequence of integers associated to their next prime, so it is possible to calculate the associated sequence primes by a prime-representing function. The difference of this approach is that the sequence of integers obtained from $\lfloor L^{2^{n}} \rfloor$ are not primes directly, it is an integer sequence, but there is an associated sequence of primes obtained from them. Here is how it works (the questions are at the end of the explanation):

According to Bertrand's postulate for a given integer (let also suppose for the demonstration that it is prime) $p_i$ it holds:

$p_i < p_j < 2p_i$ for some existing prime $p_j$

Now adding $+p_i^2+1$ in the inequalities:

$p_i+p_i^2+1 < p_j+p_i^2+1 < 2p_i+p_i^2+1$

Which is also true if in the left side we just leave $p_i^2$:

$p_i^2 < p_j+p_i^2+1 < (p_i+1)^2$

Calling $e_j = p_j+p_i^2+1$ it is possible to build (from here I will use the same steps as in Mill's paper) a sequence of integers $E_1, E_2,...E_n$ such as:

$E_1=P_1=2$

$E_1^2 < E_2 < (E_1+1)^2$

$E_2^2 < E_3 < (E_2+1)^2$

...

$E_{n-1}^2 < E_n < (E_{n-1}+1)^2$

...

The same conditions for the sequence shown in Mill's demonstration would hold for this expression, and in this case the exponent is $2$ instead of $3$ but we do not depend on Legendre's conjecture because the associated prime $P_n$ to $E_n$ is a Bertrand's prime (so it exists always in the interval $[E_n,2E_n]$). In other words, it is possible to use the power of $2$ because the sequence is not directly a sequence of primes, but a sequence of integers attached to primes by Bertrand's postulate according to the manipulation:

$P_n = E_n-E_{n-1}^2-1$

And in the same fashion as Mill's constant:

$E_n=\lfloor L^{2^{n}} \rfloor$

Where L is obtained after some manual calculations (up to $n=11$) as

$L_{11}=1.7197977844041078190854...$

The way of manually calculating the constant is as follows, in the same fashion that Mill's demonstration, the relationship between $L_n$ (the constant calculated after knowing the $n^{th}$ element of the sequence $E_n$) and $E_n$ is:

$L_n=E_n^{\frac{1}{2^n}}$

These are the calculations for the first $5$ elements:

For instance for $n=1..5$, $\lfloor L^{2^{n}} \rfloor$ is:

$E_1=2$

$E_2=8$ and $P_1=E_2-(E_1)^2-1=8-2^2-1=3$

$E_3=76$ and $P_2=E_3-(E_2)^2-1=76-8^2-1=76-64-1=11$

$E_4=5856$ and $P_3=E_4-(E_3)^2-1=5856-76^2-1=5856-5776-1=79$

$E_5=34298594$ and $P_4=E_5-(E_4)^2-1=34298594-5856^2-1=5857$

$L$ slightly grows on every iteration but the growth is each time smaller, so it clearly tends to a fixed value when $n \to \infty$. This is the graph:

enter image description here

So in essence the prime-representing function would be:

$P_n = \lfloor L^{2^{n}} \rfloor -E_{n-1}^2-1 = \lfloor L^{2^{n}} \rfloor -(\lfloor L^{2^{n-1}} \rfloor)^2-1$ for $n \ge 2$, $P_n \in \Bbb P$.

...being the starting element of the sequence $E_1=2=P_1$ and $L$ the value of $L_n$ when $n \to \infty$.

This is the Python code to calculate and test $L$, please be free to use it or modify it:

def mb():
    from sympy import nextprime
    from gmpy2 import is_prime
    import matplotlib.pyplot as plt
    import matplotlib as mpl
    import decimal

    print("L constant test. Equivalent to Mill's constant applying Bertrand's postulate")
    print("----------------------------------------------------------------------------")
    print()

    # Decimal precision is required, change according to test_limit
    decimal.getcontext().prec = 2000
    # List of elements E_n generated by L^(2^(n))
    E_n = []
    # List of progressive calculations of L_n, the last one of the list is the most accurate
    # capable of calculate all the associated primes
    L_n=[]
    # List of primes obtained from L^(2^(n))-E_(n-1) associated to the Bertrand's postulate
    P_n=[]
    # depth of L: L will be able to calculate the primes L^(2^(n))-E_(n-1) for n=1 to test_limit-1
    test_limit=12
    for n in range(1,test_limit):
        if n==1:
            # E_1=2
            E_n.append(2)
        else:
            # E_n=(E_(n-1)^2)+1
            # Be aware that the Python list starts in index 0 and the last current element is index n-1:
            # that is why n-2 appears in the calculation below
            E_n.append((E_n[n-2]**(decimal.Decimal(2)))+P_n[n-2]+1)
        # Next prime greater than E_n: it will be in the interval [E_(n-1),2*E_(n-1)] (Bertrand's postulate)
        P_n.append(nextprime(E_n[n-1]))
        # Calculation of L_n
        L_n.append(E_n[n-1]**(decimal.Decimal(1)/(decimal.Decimal(2)**(decimal.Decimal(n)))))

    print("List of Elements of L^(2^(n)) for n = 1 to " + str(test_limit-1) + ":")
    mystr = ""
    for i in E_n:
        mystr=mystr+str(i)+"\t"
    print(mystr)

    print()
    print("List of Primes obtained from L constant: L^(2^(n))-E_(n-1)-1 for n = 1 to :" + str(test_limit-1) + ":")
    mystr = ""
    for i in P_n:
        mystr=mystr+str(i)+"\t"
    print(mystr)

    print()
    print("List of calculations of L_n (the most accurate one is the last one) for n = 1 to :" + str(test_limit-1) + ":")
    mystr = ""
    ax = plt.gca()
    ax.set_axis_bgcolor((0, 0, 0))
    figure = plt.gcf()
    figure.set_size_inches(18, 16)
    n=1
    for i in L_n:
        mystr=mystr+str(i)+"\t"
        plt.plot(n,i,"w*")
        n=n+1
    print(mystr)

    # Print the graph of the evolution of L_n
    # Clearly it tends to one specific value when n tend to infinity
    plt.show()

    #Testing the constant
    print()
    print("L Accuracy Test: using the most accurate value of L will calculate the primes associated")
    print("to the constant and will compare them to the original primes used to create the constant.")
    print("If they are the same ones, the constant is able to regenerate them and the theoretical background")
    print("applied would be correct.")
    #Using the most accurate value of L available
    L = L_n[len(L_n)-1]
    print()
    print("L most accurated value is:")
    print(L)
    print()
    for i in range(1,test_limit):
        print()
        tester = int(L**(decimal.Decimal(2)**(decimal.Decimal(i))))
        if i==1:
            tester_prime = 2
        else:
            tester_prime = decimal.Decimal(tester) - (E_n[i-2]*E_n[i-2]) - 1
        print("Current calculated E:\t" + str(tester) + " for n = " + str(i))
        print("Original value of E:\t" +str(E_n[i-1]) +  " for n = " + str(i))
        if tester == E_n[i-1]:
            print("Current calculated prime:\t" + str(tester_prime) +  " for n = " + str(i))
            if i==1:
                print("Original value of prime:\t2 for n = " + str(i))
            else:
                print("Original value of prime:\t" + str(P_n[i-2]) + " for n = " + str(i))
        else:
            # If we arrive to this point, then the constant and the theory would not be correct
            print("ERROR L does not generate the correct original E")
            return
    print()
    print("TEST FINISHED CORRECTLY: L generates properly the primes associated to the Bertrand's postulate")
mb()

The list of first primes is (the Python code provides the output up to $n=11$)

$2,3,11,79,5857,34298597,1176393584675453,1383901866065518680880707763873,$

$1915184374899624805461632693020424461862877625516091453480257,...$

Initially $L=1.71979778...$ seems not have been defined before, but I am not really sure. At least I was not able to find such constant at Mill's constant-related papers on Internet, but it seems interesting.

The advantages of $L$ versus $A$ (the original Mill's constant) would be:

  1. The growth rate of the double exponential is lower due to the use of powers of $2$ instead of powers of $3$ (or more for other Mill's constant interpretations), so for the same quantity of $n$ values calculated, $L$ provides smaller primes than $A$ in less time.

  2. The use of $\lfloor L^{2^{n}} \rfloor$ would not require the validation of Legendre's conjecture because it depends on Bertrand's postulate, so the theory would hold as it is.

I would like to ask the following questions:

  1. Are the manipulations for the calculation of the elements of $\lfloor L^{2^{n}} \rfloor$ applying Bertrand's postulate correct or there is a restriction or error? (initially the heuristics show that it would be correct)

  2. Is such constant interesting? Initially seems so because it is able to use a power of $2$ growth rate (versus power of $3$ in best of cases for standard Mill's constant).

  3. If the calculations are correct, are there other manipulations that could be applied to lower even more the growth rate? Thank you!