Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Evaluate the primorial
| ResourceFunction["Primorial"][n] calculates the product of the primes up to n. | 
Compute the primorial  :
:
| In[1]:= | ![ResourceFunction["Primorial"][23]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/1e2fa4bba6d91cd2.png) | 
| Out[1]= |  | 
Compute a list of the first 15 primorials:
| In[2]:= | ![ResourceFunction["Primorial"][Range[15]]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/597838475a9e51d9.png) | 
| Out[2]= |  | 
For non-positive numbers, the primorial is defined to be equal to 1:
| In[3]:= | ![ResourceFunction["Primorial"][-4]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/127b4b1141e52a50.png) | 
| Out[3]= |  | 
Compare with the definition:
| In[4]:= | ![With[{k = 7}, Product[Prime[j], {j, 1, PrimePi[k]}] == ResourceFunction["Primorial"][k]]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/1e56567781143a35.png) | 
| Out[4]= |  | 
The resource function ChebyshevTheta is the logarithm of the primorial:
| In[5]:= | ![With[{k = 7}, Exp[ResourceFunction["ChebyshevTheta"][k]] == ResourceFunction["Primorial"][k]]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/5ee6610c64c7d8cb.png) | 
| Out[5]= |  | 
Evaluate the infinite primorial:
| In[6]:= | ![Product[Prime[k], {k, 1, \[Infinity]}, Regularization -> "Dirichlet"]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/54860b637112aeab.png) | 
| Out[6]= |  | 
| In[7]:= | ![ResourceFunction["Primorial"][\[Infinity]]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/0f0ca4c852aeed93.png) | 
| Out[7]= |  | 
Compare the growth rate of the primorial to that of the factorial:
| In[8]:= | ![DiscretePlot[{ResourceFunction["Primorial"][n], Factorial[n]}, {n, 1, 50}, ScalingFunctions -> "Log", PlotLegends -> {"n#", "n!"}]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/10245725a8634a12.png) | 
| Out[8]= |  | 
Plot the differences between the factorial and the primorial up to n:
| In[9]:= | ![ListLinePlot[
 Differences[
  Table[Log[n!/ResourceFunction["Primorial"][n]], {n, 1, 100, 1}]], Filling -> Axis]](https://www.wolframcloud.com/obj/resourcesystem/images/1ba/1ba58f96-8745-419b-bb21-04c24efbf6e2/0b681e77a8cdf64f.png) | 
| Out[9]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License