Why do the closest primes whose distance $d \gt 1$ to $c(n)=\frac{(n+1)!+n!}{2}$ have always $d \in \Bbb P$?

133 Views Asked by At

I have made the following observation: define the center of $n!$ and $(n+1)!$, $c(n)$, as the number located exactly in the middle of $(n+1)!$ and $n!$.

Def: $\forall n \gt 2\ , \ c(n)=\frac{(n+1)!+n!}{2}$

Then search the closest primes to the left and right of $c(n)$ whose distance $d$ to $c(n) \gt 1$:

$p_{closer-to-c(n)-from-left} \lt c(n) \lt p_{closer-to-c(n)-from-right}$

The following seems to be true $\forall n \gt 2$: the distance $d \gt 1$ of both prime numbers to $c(n)$ is also a prime number.

$p1=d(p_{closer-to-c(n)-from-left},c(n))$

$p2=d(p_{closer-to-c(n)-from-right},c(n))$

$\forall n \gt 2, p1,p2 \in \Bbb P$

This is the Python code, just in case somebody would like to try or modify it for higher $n$'s:

def factorials():
    from sympy import nextprime, prevprime
    from gmpy2 import is_prime, fac

    print("n"+"\t"+"Side"+"\t"+"Result"+"\t"+"d"+"\t"+"p")
    for n in range(2,200):  

        myfact = fac(n)
        myfactn = fac(n+1)

        cen = int(((myfactn+myfact)//2))
        currprime = prevprime(cen-1)
        while not is_prime(currprime):
            currprime = prevprime(currprime-1)

        if is_prime(cen-currprime):
            print(str(n) + "\t" + "Left" + "\t" + "Success" + "\t" + str(cen-myprime) + "\t" + str(currprime))
        else:
            print(str(n) + "\t" + "Left" + "\t" + "Error" + "\t" + str(cen-myprime) + "\t" + str(currprime))

        currprime = nextprime(cen+1)
        while not is_prime(currprime):
            currprime = nextprime(currprime+1)

        if is_prime(currprime-cen):
            print(str(n) + "\t" + "Right" + "\t" + "Success" + "\t" + str(currprime-cen) + "\t" + str(currprime))
        else:
            print(str(n) + "\t" + "Right" + "\t" + "Error" + "\t" + str(currprime-cen) + "\t" + str(currprime))

factorials()

E.g.:

$n=42:$

$p1=73=d(p_{closer-to-c(42)-from-left},c(42))$

$p2=307=d(p_{closer-to-c(42)-from-right},c(42))$

$n=193:$

$p1=223=d(p_{closer-to-c(193)-from-left},c(193))$

$p2=421=d(p_{closer-to-c(193)-from-right},c(193))$

The results are very interesting, I did not expect this kind of property related with the center of two consecutive factorials. I do not understand why it happens, so I would like to share the following questions:

  1. Does it make sense that according to the definition or properties of the factorials, this center point $c(n)$ was able to have those properties?

  2. Is there a counterexample of them?

  3. Is it a trivial property?

Thank you!

1

There are 1 best solutions below

2
On BEST ANSWER

This is not a complete answer, but hopefully it explains why your observation is unsurprising.

Note that for $n \geq 4$, $c(n)$ is a multiple of every $m \leq n$. So, if $c(n) \pm k$ is prime, every prime factor of $k$ must be greater than $n$.

This means that it is very likely that the smallest $k>1$ such that $c(n) \pm k$ is prime will itself be prime. Indeed, if $k$ is composite but $c(n) \pm k$ prime, then $k$ must have at least two prime factors greater than $n$, and so we must have $k > n^2$ — but if $k$ is prime, we need only have $k > n$.

Heuristically, we can abuse the Prime Number Theorem to get a rough sense of how likely your observation is. There are about $\frac{n^2}{2 \ln n}$ prime $k$ less than $n^2$, and for each one the probability that $c(n)\pm k$ is prime is about $\frac{1}{\ln n!} \approx \frac{1}{n \ln n}$. So we should expect something like $\frac{n}{2 (\ln n)^2}$ prime values of $k$ with $c(n) \pm k$ prime before we could possibly find any composite values; as this number grows significantly with $n$, it's not surprising that we can (apparently) always find one.