Quarry School

Find what fits in three bits

Subject: Computing
Level 1 · FoundationsAbout 4 min read
How this was estimated

Programmatic estimate. Rung levels, worked steps, prerequisites, terms and sentence length contribute to this level. It describes the lesson, not your ability.

Reading counts the whole lesson, including folded explanations, at 180 words a minute. Practice allows two minutes per item. These are planning assumptions; take the time you need.

AI estimate unavailable.

Path to here

Open the unit’s lesson list to follow the lesson order.

    Quick review (2 minutes)

    In plain words

    Imagine a fair booth that prints 000 on its first ticket.

    Rule

    Start with one empty row and double the count for each bit you add. Two choices for each of three positions make eight patterns. The unsigned values run from zero to one less than the pattern count. With three bits they run from 0 through 7.

    Step

    1. Write down the convention, the rule for using the codes. Give each ticket a different three-bit pattern and make every pattern available.

    2. Begin with no digits and fill the slots from left to right. Follow 0 before 1 at each split. Record the row once it has three digits, then go back to the last split with a branch left to follow. Finish when you have followed every branch.

    3. Count the finished rows, including 000. Find the largest unsigned value by adding the place values in the all-ones row.

    Trap

    If you counted seven codes, check where you started. The pattern 000 reads as zero and is one of the eight patterns. If the booth sets 000 aside to mean “no ticket,” it still appears in the list. The booth has seven codes to hand out.

    1 In plain words

    Imagine a fair booth that prints 000 on its first ticket. Each of the three slots holds one bit, a digit that can be 0 or 1. The width is the number of slots. A fixed width of three means keeping all three digits on every ticket, including zeros on the left.

    A pattern is the whole row of digits. When that row identifies a ticket, it is the ticket's code. You can also read the row as an unsigned number, a whole number that is zero or greater. In that reading, 000 is 0 because every slot adds zero.

    Write 1 above the rightmost slot and double as you move left. The resulting numbers, 4, 2 and 1 from left to right, are the place values. Add the place values with a 1 underneath, so 010 gives 2 from the middle slot. Keep the place values above your slots so you can look them up as you work.

    2 Picture it

    3 bits000001010011100101110111

    In counting order the patterns are 000, 001, 010, 011, 100, 101, 110 and 111. Each row in the trace gives its unsigned value.

    All eight three-bit patterns

    3 Why

    Each new slot gives every row so far two different endings. Rows that split earlier already differ at the slot where they split. You can find any complete pattern by following its digits from left to right, so each complete row appears once.

    The largest unsigned value comes from putting a 1 in every slot. That row adds every place value. Changing any of its digits to 0 takes that place value out of the sum.

    4 The rule

    Start with one empty row and double the count for each bit you add.

    Two choices for each of three positions make eight patterns. The unsigned values run from zero to one less than the pattern count. With three bits they run from 0 through 7.

    5 How

    1. Write down the convention, the rule for using the codes. Give each ticket a different three-bit pattern and make every pattern available.
    2. Begin with no digits and fill the slots from left to right. Follow 0 before 1 at each split. Record the row once it has three digits, then go back to the last split with a branch left to follow. Finish when you have followed every branch.
    3. Count the finished rows, including 000. Find the largest unsigned value by adding the place values in the all-ones row.

    6 Trace

    List every unsigned three-bit code
    CodeValueExplanation
    0000No place contributes.
    0011Only the ones place contributes.
    0102Only the twos place contributes.
    0113Add two and one.
    1004Only the fours place contributes.
    1015Add four and one.
    1106Add four and two.
    1117All three places contribute. All eight patterns have been used.

    7 The trap

    If you counted seven codes, check where you started. The pattern 000 reads as zero and is one of the eight patterns. If the booth sets 000 aside to mean “no ticket,” it still appears in the list. The booth has seven codes to hand out.

    Quick checks

    Quick check 1 of 2

    The booth sets 000 aside to mean “no ticket.” How many tickets can still get different codes? Can 111 still be used?

    Show the steps and the answer
    Answer

    Seven tickets can get different codes, and 111 is still available.

    Why: Of the eight patterns, only 000 is set aside.

    Source: University of Canterbury Computer Science Education Research Group, Numbers

    Quick check 2 of 2

    A locker label has two bit slots. Use each pattern at most once and keep all patterns available. List the labels with 0 before 1 at each split. How many lockers can you label, and what is the largest unsigned value?

    Show the steps and the answer
    Answer

    00, 01, 10, 11. Four lockers. The largest unsigned value is 3.

    Why: Each first digit has two choices for the second digit. The two place values are 2 and 1, and 11 uses both.

    Source: University of Canterbury Computer Science Education Research Group, Numbers

    Sources

    1. Numbers. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 25 Nov 2026.