power-of-two-bit-trick

Status: IN

`n & (n - 1) == 0` detects positive integers with exactly one set bit (powers of two); this is a foundational kernel reused in power-of-four and referenced by number-of-1-bits (Brian Kernighan's algorithm) across the repo.

Source: entries/2026/06/06/power-of-two-solution.md

JSON