What is Nostr?
Per Vognsen /
npub152t…v7uc
2024-11-28 04:52:44
in reply to nevent1q…m2z2

Per Vognsen on Nostr: nprofile1q…6gyrf I'm invariant-pilled but I think I slightly prefer to think of ...

nprofile1qy2hwumn8ghj7un9d3shjtnddaehgu3wwp6kyqpqf3nlrmpjja65pzmvlegyl27l0y2m007nncxttdwqndrejajvdzask6gyrf (nprofile…gyrf) I'm invariant-pilled but I think I slightly prefer to think of this algorithm in terms of algebraic laws:

popcount(0) = 0
popcount(x) = popcount(clear_lowest_bit(x)) + 1 if x != 0

This can be turned directly into a function definition. Of course you have also have to prove clear_lowest_bit(x) = x & (x - 1) if x != 0.
Author Public Key
npub152ta9mm2x6nk4ffyrn7ycz444vf7x743t24yddyd40vvcwkw39wqv3v7uc