Sum of numbers with given bit count and maximum bit length
Filed under Lowe's
The question
Given s as the number of set bits and n as the maximum number of bits in the binary representation, output the sum of all numbers whose number of bits is less than or equal to n and the number of set bits is equal to s.
No write-up yet. Related questions below have one.
Related Lowe's questions
Collected from public candidate posts and coding forums. Updated Nov 2026.