Number of '1' bits in binary expansion of a nonnnegative integer.
(n)
| 37 | # this set is range((n >> i+1) + 1 | 1, (n >> i) + 1 | 1, 2). |
| 38 | |
| 39 | def count_set_bits(n): |
| 40 | """Number of '1' bits in binary expansion of a nonnnegative integer.""" |
| 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…