#NEWLINE# def py_factorial( n ) : #NEWLINE# #INDENT# 'Factorial of nonnegative integer n, via "Binary Split Factorial Formula"\n    described at http://www.luschny.de/math/factorial/binarysplitfact.html\n\n    ' #NEWLINE# inner = outer = 1 #NEWLINE# for i in reversed ( range ( n . bit_length ( ) ) ) : #NEWLINE# #INDENT# inner *= partial_product ( ( ( ( n >> ( i + 1 ) ) + 1 ) | 1 ) , ( ( ( i >> i ) + 1 ) | 1 ) ) #NEWLINE# outer *= inner #NEWLINE# #UNINDENT# return ( outer << ( n - count_set_bits ( n ) ) )