Skip to content

Three-digit codes with nonzero digits summing to 10 or less

Question

A safe opens with a code of three digits. No digit is 00, and the three digits together add up to at most 1010. How many codes are possible?

Short answer

120120. Add a slack variable: d1+d2+d3+s=10d_1+d_2+d_3+s=10 with di≥1d_i\ge1, s≥0s\ge0. Substituting di′=di−1d_i'=d_i-1 gives four non-negative parts summing to 77, so (103)=120\binom{10}{3}=120 (the cap of 99 per digit never binds).

Adapted from OpenQuant; question and answer rewritten by SelfMadeQuant.com.

See the hint and the full worked solution in the question bank (free account).

Open the worked solution

Lessons behind this question

Start with a free lesson: Probability Fundamentals is part of a free topic. Create a free account, no card needed, to read it in full with worked solutions.

Read it free