Skip to main content

nat_count_ones

Function nat_count_ones 

Source
pub open spec fn nat_count_ones(n: nat) -> nat
Expand description
{ if n < 2 { n } else { n % 2 + nat_count_ones(n / 2) } }

The number of 1 bits in the binary representation of n.