Is there any way to reduce the time complexity of the factorial function below O(n), and what is the time complexity of its implementation in the math library in python?
Also, is any memorization done for some set of inputs (in Python 3), to further reduce its runtime?
If you do not mind floating point precision, math.lgamma(n+1) returns the natural logarithm of the factorial of n.
What is the time complexity of math.factorial() function in python?