(n, memo={0:1, 1:1})
return p
Return n factorial (for integers n >= 0 only).
Return n factorial (for integers n >= 0 only).
Return n factorial ( for integers n > = 0 only ) .
def ifac(n, memo={0:1, 1:1}):
    """Return n factorial (for integers n >= 0 only)."""
    f = memo.get(n)
    if f:
        return f
    k = len(memo)
    p = memo[k-1]
    MAX = MAX_FACTORIAL_CACHE
    while k <= n:
        p *= k
        if k <= MAX:
            memo[k] = p
        k += 1
    return p
def ifac ( n , memo = { 0 : 1 , 1 : 1 } ) : f = memo . get ( n ) if f : return f k = len ( memo ) p = memo [ k - 1 ] MAX = MAX_FACTORIAL_CACHE while k <= n : p *= k if k <= MAX : memo [ k ] = p k += 1 return p