Product of integers in range(start, stop, 2), computed recursively. start and stop should both be odd, with start <= stop.
(start, stop)
| 41 | return 1 + count_set_bits(n & n - 1) if n else 0 |
| 42 | |
| 43 | def partial_product(start, stop): |
| 44 | """Product of integers in range(start, stop, 2), computed recursively. |
| 45 | start and stop should both be odd, with start <= stop. |
| 46 | |
| 47 | """ |
| 48 | numfactors = (stop - start) >> 1 |
| 49 | if not numfactors: |
| 50 | return 1 |
| 51 | elif numfactors == 1: |
| 52 | return start |
| 53 | else: |
| 54 | mid = (start + numfactors) | 1 |
| 55 | return partial_product(start, mid) * partial_product(mid, stop) |
| 56 | |
| 57 | def py_factorial(n): |
| 58 | """Factorial of nonnegative integer n, via "Binary Split Factorial Formula" |
no outgoing calls
no test coverage detected
searching dependent graphs…