Bit strings with three ones
How many 8-bit strings (like 01101000) contain exactly three 1s?
Show hint
You are choosing which 3 of the 8 positions hold a 1. Order of choosing does not matter.
Show solution
56.
That is "8 choose 3" = 8! / (3! · 5!) = (8 × 7 × 6) / (3 × 2 × 1) = 56. In Python: math.comb(8, 3).
Want a problem like this every day? See today's problem and keep a streak going.