This is a useful function. Thank you for providing it. Since it goes through the trouble of finding and multiplying out all prime numbers <= n, it would be even better if it also returned an unsigned long int that gives the number of primes found and used in the calculation.