- #51

mfb

Mentor

- 34,976

- 11,164

It can be approximated, but you need an extremely precise result. Also, the formula doesn't work for the product of the first n primes, or subsets of it.A factorial (and by extension multifactorial) can be evaluated within a range formulaic using Sterling's formula. You don't need tho multiply all primes. The calculated ranges can be used to proof if a sum is prime.

Well, you can speed that up significantly. Make 10That means the products will take up about a terabyte, which means ~1000 seconds just to get them in and out of memory. That means the whole process will take 10^16 seconds, or of order a billion years.

^{13}multiplications of 12-digit numbers, 5*10

^{12}multiplications of 24-digit numbers, ... so memory usage is only ld(10

^{13})*10

^{13}*6 bytes or ~1000 TB.

The last multiplication step is the most elaborate one, but it can be done in O(n log n log log n). You don't need a supercomputer to do that in a year.