ArticleslgStudy

computer science

Busy beaver

Busy beaver is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Busy beaver rather than just read about it. In short: In theoretical computer science, a busy beaver is a Turing program that generates the longest finite output among all programs with the same number of states. A program that generated a longer output must necessarily continue generating forever, i.e. cannot terminate.

Busy beaver — main illustration
Busy beaver — illustration

Key takeaways

  • Busy beaver belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Busy beaver to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Busy beaver from memory before moving on to harder problems.

Reference excerpt

In theoretical computer science, a busy beaver is a Turing program that generates the longest finite output among all programs with the same number of states. A program that generated a longer output must necessarily continue generating forever, i.e. cannot terminate. It is generally undecidable whether a given program is a busy beaver; hence examples are known only for the first few state counts. The busy beaver game aims to find new busy beaver examples. Rather than traditional programming languages, the programs used in the game are Turing machines, one of the first mathematical models of computation. A Turing machine consists of an infinite tape, a finite set of states, and a set of transitions between them which serve as the program's "machine code". The tape is initially blank. Consider all Turing machines that have n states and, when run on a blank tape, will halt eventually. Only finitely many such machines exist. Such a machine B is called an n-state busy beaver if no other such machine writes more non-blank symbols on the tape than B. The number of non-blank symbols written by B is called its score, and symbolized as Σ(n). A variant asks for the maximum run time rather than the maximum output length. The maximum number of computation steps an n-state Turing machine can run on an initially blank tape before halting is symbolized as S(n). The n-state busy beaver game consists of finding the highest-scoring or longest-running Turing machine which has n states and eventually halts. The objective of the game is to program a set of transitions between states aiming for the highest score or the longest running time while making sure the machine will halt eventually. Both the functions S(n) and Σ(n) eventually become larger than any computable function and are hence noncomputable. This has implications in computability theory, the halting problem, and complexity theory. The concept of a busy beaver was first introduced by Tibor Radó in his 1962 paper, "On Non-Computable Functions". If it were possible to compute the functions S(n) and Σ(n) for all n, then this would resolve all mathematical conjectures that can be reduced to a halting problem, e.g., into a form of "does ⟨this Turing machine⟩ halt". For example, there is a 25-state Turing machine that checks Goldbach's conjecture for each number and halts on a counterexample; if this machine does not halt after running for S(25) steps, then it must run forever, resolving the conjecture. Many other problems, including the Riemann hypothesis (120 states) and the consistency of ZF set theory (745 states), can be expressed in a similar form, where at most a countably infinite number of cases need to be checked.

Technical definition The n-state busy beaver game (or BB-n game), introduced in Tibor Radó's 1962 paper, involves a class of Turing machines, each member of which is required to meet the following design specifications:

"Running" the machine consists of starting in the starting state, with the current tape cell being any cell of a blank (all-0) tape, and then iterating the transition function until the Halt state is entered (if ever). If the machine eventually halts, then the number of 1s finally remaining on the tape is called the machine's score. An n-th busy beaver, BB-n or simply "busy beaver" is a Turing machine that wins the n-state busy beaver game. Depending on definition, it either attains the highest score (denoted by Σ(n)), or runs for the longest time (S(n)), among all other possible n-state competing Turing machines.

Example The rules for one 1-state Turing machine might be:

In state 1, if the current symbol is 0, write a 1, move one space to the right, and transition to state 1 In state 1, if the current symbol is 1, write a 0, move one space to the right, and transition to HALT This Turing machine would move to the right, swapping the value of all the bits it passes. Since the starting tape is all 0s, it would make an unending string of ones. This machine would not be a busy beaver contender because it runs forever on a blank tape.

Functions In his original 1962 paper, Radó defined two functions related to the busy beaver game: the score function Σ(n) and the shifts function S(n). Both take a number of Turing machine states n and output the maximum score attainable by a Turing machine of that number of states by some measure. The score function Σ(n) gives the maximum number of 1s an n-state Turing machine can output before halting, while the shifts function S(n) gives the maximum number of shifts (or equivalently steps, because each step includes a shift) that an n-state Turing machine can undergo before halting. He proved that both of these functions were noncomputable, because they each grew faster than any computable function. The function BB(n) has been defined to be either of these functions, so that notation is not used in this article. A number of other uncomputable functions can also be defined based on measuring the performance of Turing machines in other ways than time or maximal number of ones. For example:

The function num(n) is defined to be the maximum number of contiguous ones a halting Turing machine can write on a blank tape. In other words, this is the largest unary number a Turing machine of n states can write on a tape. The function space(n) is defined to be the maximal number of tape squares a halting Turing machine can read (i.e., visit) before halting. This includes the starting square, but not a square that the machine only reaches after the halt transition (if the halt transition is annotated with a move direction), because that square does not influence the machine's behavior. This is the maximal space complexity of an n-state Turing machine. These four functions together stand in the relation num(n)≤Σ(n)≤space(n)≤S(n). More functions can also be defined by operating the game on different computing machines, such as 3-symbol Turing machines, non-deterministic Turing machines, the lambda calculus (sequence A333479 in the OEIS) or even arbitrary programming languages.

… excerpt ends here. Continue reading the full article.

Illustrations

Busy beaver: This "space–time diagram"[1] shows the state of the memory tape on a row for the first 100,000 timesteps of the 5-state busy beaver from top to bottom. Orange is "1", white is "0" (image compressed vertically).
This "space–time diagram"[1] shows the state of the memory tape on a row for the first 100,000 timesteps of the 5-state busy beaver from top to bottom. Orange is "1", white is "0" (image compressed vertically).
Busy beaver: Hypothetical run of the constructed counter-example Turing machine
Hypothetical run of the constructed counter-example Turing machine
Busy beaver: A zoomed-out space-time diagram of the 5-state busy beaver machine. The diagram is modified so only steps which change the tape are shown, leading to triangular shapes appearing in the diagram. Green and yellow triangles indicate regions where the Turing machine shuttles back and forth; the time taken is proportional to the areas of these colored triangles. The bottom row is an excerpt of the tape and the read/write head upon halting.
A zoomed-out space-time diagram of the 5-state busy beaver machine. The diagram is modified so only steps which change the tape are shown, leading to triangular shapes appearing in the diagram. Green and yellow triangles indicate regions where the Turing machine shuttles back and forth; the time taken is proportional to the areas of these colored triangles. The bottom row is an excerpt of the tape and the read/write head upon halting.
Busy beaver: Animation of a 3-state, 2-symbol busy beaver
Animation of a 3-state, 2-symbol busy beaver
Busy beaver: Animation of a 4-state, 2-symbol busy beaver
Animation of a 4-state, 2-symbol busy beaver

Worked examples

Example 1 — a first encounter with Busy beaver

Start with the simplest possible case. Write down what Busy beaver claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Busy beaver before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Busy beaver ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Busy beaver

In research
Busy beaver appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Busy beaver in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Busy beaver is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computability theory, Large integers, Metaphors referring to aquatic life, so understanding it makes those chapters shorter.
In everyday life
Look for Busy beaver outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Busy beaver” →

How to study Busy beaver in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Busy beaver means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Busy beaver out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Busy beaver in simple terms?

In theoretical computer science, a busy beaver is a Turing program that generates the longest finite output among all programs with the same number of states. A program that generated a longer output must necessarily continue generating forever, i.e. cannot terminate.

Why does Busy beaver matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Busy beaver?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Busy beaver.

Tags

  • Computability theory
  • Large integers
  • Metaphors referring to aquatic life
  • Metaphors referring to rodents
  • Theory of computation

Keep exploring