def py_factorial(n):
 inner = outer = 1
 for i in reversed(range(n.bit_length())):
  inner *= partial_product((((n >> (i + 1)) + 1) | 1), (((n >> i) + 1) | 1))
  outer *= inner
 return (outer << (n - count_set_bits(n)))

def py_factorial ( n ) : inner = outer = 1 for i in reversed ( range ( n . bit_length ( ) ) ) : inner *= partial_product ( ( ( ( n >> ( i + 1 ) ) + 1 ) | 1 ) , ( ( ( n >> i ) + 1 ) | 1 ) ) outer *= inner return ( outer << ( n - count_set_bits ( n ) ) )
factorial of nonnegative integer n .