SASMO Counting: Classify the Last Symbol Before Counting Binary Strings

How many strings of length six made from zero and one have no pair of adjacent ones? Leading zeros are allowed, so the strings are not being treated as six-digit positive integers. This original SASMO-style exercise asks for a complete count, not a probability. The main task is to divide the valid strings into classes that neither overlap nor leave a permissible ending uncounted.

Need help choosing a next step? Scan the contact QR code below or contact Hanlin on WeChat. Send SASMO-S5-1126 and tell us your school year and question.

Define a count for every shorter length

Let f of n count valid strings of length n. For length zero there is one empty string, which is a useful counting boundary rather than a written numeral. For length one the strings are zero and one, so the count is two. These starting values must match the convention that leading zeros are allowed.

Classify valid strings ending in zero

Appending a zero to any valid string of length n minus one creates a valid string of length n ending in zero. Conversely, removing that final zero recovers exactly one shorter valid string. This reversible correspondence establishes a count of f of n minus one for this class, without counting a shorter string more than once.

Classify the strings ending in one

For length at least two, a valid final one must be preceded by zero. Remove the final zero-one block and what remains is any valid string of length n minus two. Appending zero-one to such a shorter string cannot introduce an adjacent-one pair across the join because the appended block starts with zero.

Add the disjoint ending classes

Every string ends in zero or one and cannot end in both. Therefore f of n equals f of n minus one plus f of n minus two for n at least two. Starting from one and two gives counts three, five, eight, thirteen and twenty-one for lengths two through six. The required answer is twenty-one.

Check the small cases and the excluded convention

At length two, the valid strings are zero-zero, zero-one and one-zero; one-one is excluded, agreeing with the recurrence. If leading zeros were forbidden, the first-symbol restriction would change the count and initial conditions. It would be incorrect to keep twenty-one merely because the same two symbols still appear.

Explain why the recurrence is a proof

The answer follows from a complete partition and two reversible constructions, not just a familiar-looking numerical sequence. Other restrictions, such as no adjacent zeros as well, require new ending states. Official resources are linked separately for independent practice. This original exercise does not reproduce a current contest question, and recognising a sequence name is optional; the case argument is what makes the count checkable.

Continue reading: SASMO Counting Practice: Subtract Paths Through a Point Without Losing Their Two Stages.

Contact Hanlin

Planning a first attempt or reviewing a topic you find difficult? Scan the QR code and send SASMO-S5-1126. Include your school year, country or competition region, experience and the question you want to discuss.

Scan to contact Hanlin on WeChat. Send SASMO-S5-1126.

Contact Hanlin on WeChat

On your phone, use the button or save the QR image and scan it within WeChat.

Official information and further reading: Source 1

Online Customer Service
Contact Customer Service