3 ms·
Technically, that isn't a continuous function, so I don't think the Remez algorithm and similar would work directly. But if you replace the factorial with the
by thayne 2y ago
Technically, that isn't a continuous function, so I don't think the Remez algorithm and similar would work directly.
But if you replace the factorial with the gamma function, you get a continuous function that is equivalent for positive integers. And you might be able to get something from that. But there might be something more efficient that can take advantage of the fact that the range of your function is positive integers.
If you just need something that doesn't overflow, you can take advantage of the properties of logarithms to compute it as the sum of log2(n) for all n from 1 to x.
- thayne 2y agoAnd if you want an integer result, log2 can be quickly computed using the number of leading zeros.