As the title explains, I am trying to know if there is a definition about the upper limit to find the first primorial $p_i\#$ (following the definition at OEIS) existing after a given factorial $n!$ (in other words, the first primorial greater than the given factorial $n!$ such as $\not\exists \ p_j\#: \ n! \lt p_j\# \lt p_i\#$).
I was looking for a similar idea to the Bertrand's postulate, e.g. it is known that there is at least one prime between a given natural number $n \gt 3$ and $2n$.
I am not sure if something similar (another type of bound) can be defined about a given factorial $n!$ and the next existing primorial, for instance:
Is there a primorial $p_i\#$ between $n!$ and $kn!$ for some $k$ constant (not necessarily a natural number)?
Does that kind of bound (postulated or demonstrated) exist? I did not find any reference.
UPDATE 2016/5/9: following the suggestion of @WillJagy I have prepared a Python code to test heuristically. Just in case if somebody wants to use it / modify it, here it is (the conclusions of the results are below):
from sympy import nextprime, factorial
import collections
calc_limit = 20000
n=1
lop=[] # list of primes
while n<calc_limit:
n=nextprime(n)
lop.append(n)
#print(lop)
n=0
lof=[] # list of factorials
while n<calc_limit:
lof.append(factorial(n))
n = n+1
#print(lof)
primoaccu = 1
lopr = [] # list of primorials
for n in lop:
primoaccu = primoaccu * n
lopr.append(primoaccu)
#print(lopr)
dict_fac = {} # factorials dictionary, keys: factorials, content: first primorial greater than the factorial key
dict_primo = {} # primorials dictionary, keys: primorials, content: all factorials who share the same closest primorial value greater than them, which is the primorial key
posprimo = 0
endloop = False
for n in lof:
if posprimo < len(lopr):
while lopr[posprimo]<=n:
posprimo=posprimo+1
if posprimo >= len(lopr):
endloop = True
break
if endloop:
break
dict_fac[n]=lopr[posprimo]
if lopr[posprimo] in dict_primo.keys():
mylist = dict_primo[lopr[posprimo]]
mylist.append(n)
dict_primo[lopr[posprimo]]=mylist
else:
dict_primo[lopr[posprimo]]=[n]
sorted_dict_fac = collections.OrderedDict(sorted(dict_fac.items()))
sorted_dict_primo = collections.OrderedDict(sorted(dict_primo.items()))
maxlen = 0
for n in sorted_dict_primo.keys():
if len(sorted_dict_primo[n]) > maxlen:
maxlen = len(sorted_dict_primo[n])
print("The maximum numbers of factorials between two primorials heuristically is "+ str(maxlen))
print("in the interval [0," + str(calc_limit) + "]" )
avg=0
for n in sorted_dict_fac.keys():
cur_avg = sorted_dict_fac[n]/n
if cur_avg>avg:
avg=cur_avg
print("Maximum (next primorial)/factorial ratio is " + str(float(avg)))
So far these are the conclusions:
Curiously in the worst of the cases there is a primorial after two consecutive factorials and sometimes there is a primorial between two consecutive factorials. But so far I did not find a case in which there is not a primorial after two consecutive factorial appear without a primorial between them. This could be due to the interval that was tested (the greater it is the slower the calculation is, I will try a greater interval)
In the other hand, the distance between the factorial and the next closer primorial (in the code it is possible to see the maximum (next primorial)/factorial ratio) gets bigger very quickly. These might be related with the ratio of factorials versus primorials. For the interval $[0,n]$ it is expected to have $n$ factorials and by the prime counting function it is expected to have only $\frac{n}{ln(n)}$ primorials and the values of the primorials spread from the positions of the closest factorials very quickly.
So as an initial conclusion, it is not possible an equivalent to the Bertrand's postulate between factorials and primorials in terms of a constant $kn!$, but it seems that it is possible to define a bound regarding how many consecutive factorials are before a primorial appears (so far in the worst of cases after $2$ consecutive factorials, a primorial appeared). To clarify, according to the results, the question would be more specifically:
Is there a primorial $p_i\#$ in the worst of cases after $k$ consecutive factorials for some $k$ constant (not necessarily a natural number)?
Does that kind of bound (postulated or demonstrated) exist? I did not find any reference. Thank you!
Evidently computations show that there is a primorial between $n!$ and $(n+2)!$ Furthermore, those $n$ such that there is not a primorial between $n!$ and $(n+1)!$ are quite regularly spaced, either four or five apart. This suggests a relatively short proof should be available, based mostly on the idea that, when $n!$ and $p\#$ are of similar size, that $p > n$ but $p < n^2.$ Indeed, as I let the bounds get larger, this pattern holds steady. The ratio $\log p / \log n \approx 1.3$ for small $n,$ about $1.28$ at the end of the output below. As $n$ gets larger still, this ratio decreases very gradually, for $n=25000$ the ratio is about $1.218.$ Should all be provable.
Yes: with the Prime Number Theorem and Chebyshev's First function, we have $$ \log( p\#) \approx p $$ With Stirling's, we have $$ \log(n!) \approx \left( n + \frac{1}{2} \right) \log n - n + \frac{1}{2} \log 2 \pi $$ This tells us $$ p \approx n \log n, $$ and we should be able to prove $p < n^2.$ Note that this also says that $p \approx p_n$