# Is there an equivalent to the Bertrand's postulate between factorials and primorials?

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:

1. 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)

2. 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:

1. Is there a primorial $p_i\#$ in the worst of cases after $k$ consecutive factorials for some $k$ constant (not necessarily a natural number)?

2. Does that kind of bound (postulated or demonstrated) exist? I did not find any reference. Thank you!

• Which definition of primordial do you use - the first one, or the second one ? – Dietrich Burde May 8 '16 at 18:45
• @DietrichBurde than you for the feedback, the first one, to clarify I have modified the notation from $m \#$ to $p_i\#$ – iadvd May 9 '16 at 0:23
• Suggest you do some computer runs and find a plausible conjecture. It is not necessary to find the actual factorials ot primorials, you can add the logarithms as real numbers (floats or doubles) for this purpose. – Will Jagy May 9 '16 at 0:26
• @WillJagy thanks for the suggestion, I will do it today, I do not have computer on Sundays. – iadvd May 9 '16 at 1:00
• You appear to be saying that tests showed, so far, that between $n!$ and $(n+2)!$ there was always a primorial. – Will Jagy May 9 '16 at 17:37

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$

4 fac  24 prime 5  primorial   30
5 fac  120 prime 7  primorial   210
6 fac  720 prime 11  primorial   2310
7 fac  5040 prime 13  primorial   30030
8 fac  40320 prime 17  primorial   510510
9 fac  362880 prime 17  primorial   510510 repeat
10 fac  3628800 prime 19  primorial   9699690
11 fac  39916800 prime 23  primorial   223092870
12 fac  479001600 prime 29  primorial   6469693230
13 fac  6227020800 prime 29  primorial   6469693230 repeat
14 fac  87178291200 prime 31  primorial   200560490130
15 fac  1307674368000 prime 37  primorial   7420738134810
16 fac  20922789888000 prime 41  primorial   304250263527210
17 fac  355687428096000 prime 43  primorial   13082761331670030
18 fac  6402373705728000 prime 43  primorial   13082761331670030 repeat
19 fac  121645100408832000 prime 47  primorial   614889782588491410
20 fac  2432902008176640000 prime 53  primorial   32589158477190044730

4             prime 5  log ratio  1.160964047443681
5             prime 7  log ratio  1.209061955122168
6             prime 11  log ratio  1.338290833105773
7             prime 13  log ratio  1.318123223061841
8             prime 17  log ratio  1.362487613750113
9             prime 17  log ratio  1.289450961581283 repeat
10             prime 19  log ratio  1.278753600952829
11             prime 23  log ratio  1.307602651165825
12             prime 29  log ratio  1.355099528698092
13             prime 29  log ratio  1.312811818366269 repeat
14             prime 31  log ratio  1.301217357406093
15             prime 37  log ratio  1.333401393805232
16             prime 41  log ratio  1.339388001154521
17             prime 43  log ratio  1.327538613914891
18             prime 43  log ratio  1.301285935076827 repeat
19             prime 47  log ratio  1.307599725771875
20             prime 53  log ratio  1.325315999898069
21             prime 59  log ratio  1.339302806043613
22             prime 59  log ratio  1.319146373895839 repeat
23             prime 61  log ratio  1.311076845011856
24             prime 67  log ratio  1.323040088005879
25             prime 71  log ratio  1.32427596122502
26             prime 71  log ratio  1.308334430025784 repeat
27             prime 73  log ratio  1.301781494528241
28             prime 79  log ratio  1.311278416172986
29             prime 83  log ratio  1.312281673753134
30             prime 83  log ratio  1.29920146111518 repeat
31             prime 89  log ratio  1.307120877989735
32             prime 97  log ratio  1.319982568437426
33             prime 101  log ratio  1.319922933301371
34             prime 103  log ratio  1.314309457548762
35             prime 103  log ratio  1.303593602671927 repeat
36             prime 107  log ratio  1.303977714284134
37             prime 109  log ratio  1.299211999752643
38             prime 113  log ratio  1.29959473429158
39             prime 113  log ratio  1.290380311658347 repeat
40             prime 127  log ratio  1.313186604961088
41             prime 131  log ratio  1.312805362500411
42             prime 137  log ratio  1.316323117955986
43             prime 137  log ratio  1.308088050220876 repeat
44             prime 139  log ratio  1.303971103589064
45             prime 149  log ratio  1.314523239029625
46             prime 151  log ratio  1.310459590552362
47             prime 157  log ratio  1.313260250880396
48             prime 157  log ratio  1.306118124866499 repeat
49             prime 163  log ratio  1.30883489232009
50             prime 167  log ratio  1.308272933291869
51             prime 173  log ratio  1.31066127439815
52             prime 173  log ratio  1.304220129541366 repeat
53             prime 179  log ratio  1.306550228242469
54             prime 181  log ratio  1.303213292051972
55             prime 191  log ratio  1.310665518754947
56             prime 191  log ratio  1.30479864408752 repeat
57             prime 193  log ratio  1.301662986757913
58             prime 197  log ratio  1.301139731555307
59             prime 199  log ratio  1.298162162222656
60             prime 211  log ratio  1.307134280504102
61             prime 211  log ratio  1.301878459496911 repeat
62             prime 223  log ratio  1.310151612957726
63             prime 227  log ratio  1.309382961390268
64             prime 229  log ratio  1.306533964682824
65             prime 229  log ratio  1.301681337220561 repeat
66             prime 233  log ratio  1.301071040266477
67             prime 239  log ratio  1.302464662143307
68             prime 241  log ratio  1.299866552385343
69             prime 241  log ratio  1.295384735252983 repeat
70             prime 251  log ratio  1.300567053587297
71             prime 257  log ratio  1.301781096624779
72             prime 263  log ratio  1.302920049662368
73             prime 269  log ratio  1.303988874931387
74             prime 269  log ratio  1.299866813918664 repeat
75             prime 271  log ratio  1.29754122618561
76             prime 277  log ratio  1.298629369273404
77             prime 281  log ratio  1.298021923580459
78             prime 281  log ratio  1.294177530247759 repeat
79             prime 283  log ratio  1.292027525733206
80             prime 293  log ratio  1.296243287083488
81             prime 307  log ratio  1.303200366193354
82             prime 307  log ratio  1.299571728138228 repeat
83             prime 311  log ratio  1.298936400206866
84             prime 313  log ratio  1.296872213728229
85             prime 317  log ratio  1.29627590404807
86             prime 331  log ratio  1.302574314368605
87             prime 331  log ratio  1.299202361808785 repeat
88             prime 337  log ratio  1.299898393065307
89             prime 347  log ratio  1.303140708699448
90             prime 349  log ratio  1.301182127948245
91             prime 349  log ratio  1.297994742186847 repeat
92             prime 353  log ratio  1.29737778690259
93             prime 359  log ratio  1.298001819347896
94             prime 367  log ratio  1.299797202483971
95             prime 367  log ratio  1.296776787915983 repeat
96             prime 373  log ratio  1.297354665166224
97             prime 379  log ratio  1.297904115250772
98             prime 383  log ratio  1.297290551536322
99             prime 389  log ratio  1.297807138467514
100             prime 389  log ratio  1.294974800662854 repeat
101             prime 397  log ratio  1.296593720326678
102             prime 401  log ratio  1.295999278112547
103             prime 409  log ratio  1.297533290795479
104             prime 409  log ratio  1.294833980738913 repeat
105             prime 419  log ratio  1.29736191665616
106             prime 421  log ratio  1.295746060308078
107             prime 431  log ratio  1.298166122706329
108             prime 433  log ratio  1.296575733040946
109             prime 433  log ratio  1.29402847122007 repeat
110             prime 439  log ratio  1.294442044127002
111             prime 443  log ratio  1.293880601582538
112             prime 449  log ratio  1.294272406187108
113             prime 449  log ratio  1.291838774802636 repeat
114             prime 457  log ratio  1.293164435069309
115             prime 461  log ratio  1.292620816709626
116             prime 463  log ratio  1.291177153968698
117             prime 463  log ratio  1.288849827436405 repeat
118             prime 467  log ratio  1.288353714716011
119             prime 479  log ratio  1.291387553869784
120             prime 487  log ratio  1.292590035776552
121             prime 491  log ratio  1.292058956470439
122             prime 491  log ratio  1.289845333751775 repeat
123             prime 499  log ratio  1.291015812562468
124             prime 503  log ratio  1.2905034872831
125             prime 509  log ratio  1.290812560169867
126             prime 509  log ratio  1.288685840995383 repeat
127             prime 521  log ratio  1.291393154331436
128             prime 523  log ratio  1.290095305178135
129             prime 541  log ratio  1.294992225049294
130             prime 547  log ratio  1.295203735400765
131             prime 547  log ratio  1.293167924182063 repeat
132             prime 557  log ratio  1.29486416614219
133             prime 563  log ratio  1.295056745865222
134             prime 569  log ratio  1.295240492388075
135             prime 569  log ratio  1.293277282245517 repeat
136             prime 571  log ratio  1.292048669668559
137             prime 577  log ratio  1.292249372986737
138             prime 587  log ratio  1.293829225605359
139             prime 593  log ratio  1.293996986411603
140             prime 593  log ratio  1.292119876942895 repeat
141             prime 599  log ratio  1.292295795265739
142             prime 601  log ratio  1.291125549815348
143             prime 607  log ratio  1.291301515260993
144             prime 607  log ratio  1.289490853027867 repeat
145             prime 613  log ratio  1.289674165452633
146             prime 617  log ratio  1.289200675655054
147             prime 619  log ratio  1.288085784329543
148             prime 619  log ratio  1.286338246312413 repeat
149             prime 631  log ratio  1.288444253464675
150             prime 641  log ratio  1.289862278449139
151             prime 643  log ratio  1.28877498057642
152             prime 647  log ratio  1.288316126875292
153             prime 647  log ratio  1.286636749253302 repeat
154             prime 653  log ratio  1.286805265185652
155             prime 659  log ratio  1.286967365239148
156             prime 661  log ratio  1.28592851569021
157             prime 661  log ratio  1.284303431803659 repeat
158             prime 673  log ratio  1.286246537035632
159             prime 677  log ratio  1.285814648076693
160             prime 683  log ratio  1.285964795921004
161             prime 691  log ratio  1.286679696034712
162             prime 691  log ratio  1.28511371440577 repeat
163             prime 701  log ratio  1.286381865761063
164             prime 709  log ratio  1.287064204411433
165             prime 719  log ratio  1.288274892739116
166             prime 719  log ratio  1.286752165704169 repeat
167             prime 727  log ratio  1.287404150733465
168             prime 733  log ratio  1.287508212080554
169             prime 739  log ratio  1.287607862847883
170             prime 743  log ratio  1.287179807725204
171             prime 743  log ratio  1.285711515751981 repeat
172             prime 751  log ratio  1.286335649623291
173             prime 757  log ratio  1.28643278414823
174             prime 761  log ratio  1.286017104502023
175             prime 761  log ratio  1.284590182702494 repeat
176             prime 769  log ratio  1.285197087135865
177             prime 773  log ratio  1.284792633941172
178             prime 787  log ratio  1.286859665923624
179             prime 797  log ratio  1.287903951787793
180             prime 797  log ratio  1.286522278274841 repeat
181             prime 809  log ratio  1.288025919181505
182             prime 811  log ratio  1.287136711555222
183             prime 821  log ratio  1.288135319410014
184             prime 821  log ratio  1.286789218766744 repeat
185             prime 823  log ratio  1.285919279377158
186             prime 827  log ratio  1.285520541746869
187             prime 829  log ratio  1.284664618410484
188             prime 839  log ratio  1.285646008158733
189             prime 839  log ratio  1.284344835247758 repeat
190             prime 853  log ratio  1.286207087041788
191             prime 857  log ratio  1.285812327007783
192             prime 859  log ratio  1.284978577047915
193             prime 859  log ratio  1.283710170936371 repeat
194             prime 863  log ratio  1.28333271074358
195             prime 877  log ratio  1.285133237185015
196             prime 881  log ratio  1.284749965421322
197             prime 883  log ratio  1.283941628770827
198             prime 883  log ratio  1.282712306551788 repeat
199             prime 887  log ratio  1.282345379129545
200             prime 907  log ratio  1.285340605134812
201             prime 911  log ratio  1.284961550467211
202             prime 911  log ratio  1.283760218158588 repeat
203             prime 919  log ratio  1.284212610855007
204             prime 929  log ratio  1.28506102658917
205             prime 937  log ratio  1.285491349641616
206             prime 941  log ratio  1.285116793760038
207             prime 941  log ratio  1.283949783407351 repeat
208             prime 947  log ratio  1.283981302025592
209             prime 953  log ratio  1.28401080503927
210             prime 967  log ratio  1.285591968361056
211             prime 971  log ratio  1.285222122250802
212             prime 971  log ratio  1.284087684877715 repeat
213             prime 977  log ratio  1.284109583893905
214             prime 983  log ratio  1.284129690639161
215             prime 991  log ratio  1.284524203306818
216             prime 991  log ratio  1.283415297051035 repeat
217             prime 997  log ratio  1.283435410792343
218             prime 1009  log ratio  1.284561493640009
219             prime 1013  log ratio  1.28420474827941
220             prime 1019  log ratio  1.284214932102065
221             prime 1019  log ratio  1.283136025387905 repeat
222             prime 1021  log ratio  1.282426717059238
223             prime 1031  log ratio  1.283163320358767
224             prime 1033  log ratio  1.282460530976638
225             prime 1033  log ratio  1.281405800065095 repeat
226             prime 1039  log ratio  1.281425909440994
227             prime 1049  log ratio  1.282148699247466
228             prime 1051  log ratio  1.281461495796648
229             prime 1061  log ratio  1.282172171129998
230             prime 1061  log ratio  1.281144820227627 repeat
231             prime 1063  log ratio  1.280469590724194
232             prime 1069  log ratio  1.280487461595997
233             prime 1087  log ratio  1.282540372201567
234             prime 1087  log ratio  1.281533522827795 repeat
235             prime 1091  log ratio  1.281205316358082
236             prime 1093  log ratio  1.280544815040064
237             prime 1097  log ratio  1.280222652931906
238             prime 1103  log ratio  1.280234373814911
239             prime 1103  log ratio  1.279254203523843 repeat
240             prime 1109  log ratio  1.27926945843662
241             prime 1117  log ratio  1.279610144947066
242             prime 1123  log ratio  1.279620812833748
243             prime 1123  log ratio  1.278660183794889 repeat
244             prime 1129  log ratio  1.278674269382533
245             prime 1151  log ratio  1.281231699906695
246             prime 1153  log ratio  1.280599083679903
247             prime 1163  log ratio  1.281223562621287
248             prime 1163  log ratio  1.280284642733178 repeat
249             prime 1171  log ratio  1.280593327425593
250             prime 1181  log ratio  1.281203819321112
jagy@phobeusjunior:~$ • If$n! < p_m\# < (n+1)!$(I'm excluding the small cases where the primorial is also a factorial), then we have$m < n < p_m$, and Dusart's bounds tell us$p_m < n\cdot (\log n + \log \log n)$for large enough$n$(actually already for pretty small$n$). Bertrand/Chebyshev then tell us$p_{m+1} < 2n(\log n + \log \log n)$, and since$2(\log n + \log \log n) < n$it follows that$p_{m+1}\# < (n+3)!$. So there are never more than two factorials between successive primorials. – Daniel Fischer May 9 '16 at 20:06 • I think there are infinitely many$m$with$p_m\# < n! < (n+1)! < p_{m+1}\#$, but I expect that the gaps between such occurrences grow (slowly). – Daniel Fischer May 9 '16 at 20:06 • @DanielFischer yes, there is a 30,000 character bound on posts here, so I can't put the output above for$n \leq 1000,$for example, as it counts over 30 characters per line. When I let$n$get much larger, the gaps between (where the program writes "repeat") spread out a bit more, four or five for small$n\$ as above, five or six later on. – Will Jagy May 9 '16 at 21:56
• @WillJagy I have no words, thank you for such interesting explanation! also to Daniel Fisher for the comments and insights. – iadvd May 9 '16 at 23:49
• @WillJagy sorry to bother you, just if interested and if you had time to read, as a follow-up of this recently I have prepared another question regarding the observation that there is at least always a factorial between the primorials of two consecutive perfect squares, so it might be a valid rewording of Legendre's conjecture and Brocard's-like conjectures. Does it makes sense? Your insights would be greatly appreciated. math.stackexchange.com/questions/1893720/… – iadvd Aug 26 '16 at 0:30