# Can someone explain to me the relationship between primorials and factorials and how that relation can be used to compute large factorials?

What I am trying to figure out is a way to compute large factorials, !1000000.

For what it's worth luschny's computer algorithms do a very good job of it.

-
You'll have to add more information than that to your question. In my opinion, one shouldn't have to know a programming language to understand a question on this math Q&A site. – Zev Chonoles Apr 26 '12 at 23:01
As Zev is suggesting, this might be appropriate for another SE site. The questions here should be math related. I'm not saying yours isn't, but rather that it is more related to programming than math. – Pedro Tamaroff Apr 26 '12 at 23:23
I included the reference to the code to provide some context for my situation. I made a few edits to hopefully clear things up. – John Apr 26 '12 at 23:31
1,000,000 factorial has about 5,000,000 digits. Do you actually want to calculate that five million digit number exactly? – Gerry Myerson Apr 26 '12 at 23:36
Have you seen Walter Koetke, Computing Factorials -- Accurately, Best of Creative Computing, Volume 1, page 172, available at atariarchives.org/bcc1/showpage.php?page=172 ? State of the art (for programs written in BASIC in 1976). Perhaps more useful is idinews.com/factorial.html – Gerry Myerson Apr 27 '12 at 1:17

$$100!=p_{1}\#^{49}\times p_{2}\#^{24}\times p_{3}\#^{8}\times p_{4}\#^{7}\times p_{5}\#^{2}\times p_{6}\#^{2}\times p_{8}\#\times p_{9}\#\times p_{11}\#\times p_{15}\#\times p_{25}\#$$
where for example $p_{3}\#^{8}$ means the eighth power of the third primorial, i.e. $(2 \times 3 \times 5)^8$.
The reason for an eighth power is that the prime factorisation of $100!$ includes $5^{24}$ and $7^{16}$ with $24-16=8$. One way of calculating this to to take $$\left( \left\lfloor \frac{100}{5^1}\right\rfloor +\left\lfloor \frac{100}{5^2}\right\rfloor +\left\lfloor \frac{100}{5^3}\right\rfloor +\cdots \right) - \left( \left\lfloor \frac{100}{7^1}\right\rfloor +\left\lfloor \frac{100}{7^2}\right\rfloor +\left\lfloor \frac{100}{7^3}\right\rfloor +\cdots \right).$$
$100! = 2^{97} 3^{48} 5^{24} 7^{16} 11^{9} 13^{7} 17^{5} 19^{5} 23^{4} 29^{3} 31^{3} 37^{2} 41^{2} 43^{2} 47^{2} 53^{1} 59^{1} 61^{1} 67^{1} 71^{1} 73^{1} 79^{1} 83^{1} 89^{1} 97^{1}$ and then take the first difference of the exponents of the primes to find the exponents of the primorials. I also showed how I found the exponents of the primes, similar to what I did in math.stackexchange.com/a/131068/6460 – Henry Apr 27 '12 at 1:07