HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A sensor sends signals as strings of the digits 0 and 1…
AdvancedMathematicsHigh School (11–12)Pigeonhole Principle, Recursion and Graph TheoryNumericalOlympiad

A sensor sends signals as strings of the digits 0 and 1…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A sensor sends signals as strings of the digits 000 and 111. To avoid a fault, the first design never sends two 111s next to each other. A second design allows two 111s next to each other but never three in a row.

Count the strings of length 111111 allowed by the first design. Then count the strings of length 888 allowed by the second design. For each design set up a recurrence by looking at how a string ends: after its last 000, how many 111s can follow? Give the starting values you use.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Name the count ana_nan​. Split on the first or the last step so that each case is a smaller copy of the same question. Check that the cases do not overlap and cover everything, then find the starting values by hand.

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Plan. Split each string on its ending, then work forward.

Step 1. First design. A good string of length nnn ends in 000 (after a good string of length n−1n - 1n−1) or in 010101 (after a good string of length n−2n - 2n−2). So sn=sn−1+sn−2s_n = s_{n-1} + s_{n-2}sn​=sn−1​+sn−2​ with s1=2s_1 = 2s1​=2 and s2=3s_2 = 3s2​=3.

Step 2. Work forward. 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, so s11=233s_{11} = 233s11​=233.

Step 3. Second design. A good string ends in 000, 010101 or 011011011, after a good string of length n−1n - 1n−1, n−2n - 2n−2 or n−3n - 3n−3. So tn=tn−1+tn−2+tn−3t_n = t_{n-1} + t_{n-2} + t_{n-3}tn​=tn−1​+tn−2​+tn−3​. Use t0=1t_0 = 1t0​=1 (the empty string), t1=2t_1 = 2t1​=2 and t2=4t_2 = 4t2​=4.

Step 4. Work forward. t3=7t_3 = 7t3​=7, t4=13t_4 = 13t4​=13, t5=24t_5 = 24t5​=24, t6=44t_6 = 44t6​=44, t7=81t_7 = 81t7​=81, t8=149t_8 = 149t8​=149.

Check. Of the 888 strings of length 333 only 111111111 is banned in the second design, which gives t3=7t_3 = 7t3​=7.

Answer: 233233233 strings for the first design and 149149149 for the second.

Log in to save this for later
← All Problems
← Some circles are drawn in a plane. Every two of them cross in exactly two points, and no three of…A strip of 2 rows and n columns is covered with tiles, with no gaps and no overlaps… →
More onPigeonhole Principle, Recursion and Graph Theory

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Setting up a recurrenceRecurrences and Counting by Recursion

More on this topic

  1. The 15 edges of K₆ are coloured red or blue…Advanced
  2. Three houses each need a path to each of three wells, nine paths in all, drawn on flat ground…Advanced
  3. A connected planar graph with 10 vertices is drawn without crossings, and every face of the…Hard
  4. The complete bipartite graph K_(m,n) joins each of m left vertices to each of n right vertices…
Advanced
  • A river town has five land areas, A, B, C, D and E, joined by ten bridges…Hard
  • All problems on this topic →