ArticleslgStudy

computer science

Automatic sequence

Automatic sequence 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 Automatic sequence rather than just read about it. In short: In mathematics and theoretical computer science, an automatic sequence (also called a k-automatic sequence or a k-recognizable sequence when one wants to indicate that the base of the numerals used is k) is an infinite sequence of terms characterized by a finite automaton. The n-th term of an automatic sequence a(n) is a mapping of the final state reached in a finite automaton accepting the digits of the number n in…

Automatic sequence — main illustration
Automatic sequence — illustration

Key takeaways

  • Automatic sequence 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 Automatic sequence to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Automatic sequence from memory before moving on to harder problems.

Reference excerpt

In mathematics and theoretical computer science, an automatic sequence (also called a k-automatic sequence or a k-recognizable sequence when one wants to indicate that the base of the numerals used is k) is an infinite sequence of terms characterized by a finite automaton. The n-th term of an automatic sequence a(n) is a mapping of the final state reached in a finite automaton accepting the digits of the number n in some fixed base k. An automatic set is a set of non-negative integers S for which the sequence of values of its characteristic function χS is an automatic sequence; that is, S is k-automatic if χS(n) is k-automatic, where χS(n) = 1 if n ∈ S and 0 otherwise.

Definition Automatic sequences may be defined in a number of ways, all of which are equivalent. Four common definitions are as follows.

Automata-theoretic Let k be a positive integer, and let D = (Q, Σk, δ, q0, Δ, τ) be a deterministic finite automaton with output, where

Q is the finite set of states; the input alphabet Σk consists of the set {0,1,...,k-1} of possible digits in base-k notation; δ : Q × Σk → Q is the transition function; q0 ∈ Q is the initial state; the output alphabet Δ is a finite set; and τ : Q → Δ is the output function mapping from the set of internal states to the output alphabet. Extend the transition function δ from acting on single digits to acting on strings of digits by defining the action of δ on a string s consisting of digits s1s2...st as:

δ(q,s) = δ(δ(q, s1s2...st-1), st). Define a function a from the set of positive integers to the output alphabet Δ as follows:

a(n) = τ(δ(q0,s(n))), where s(n) is n written in base k. Then the sequence a = a(1)a(2)a(3)... is a k-automatic sequence. An automaton reading the base k digits of s(n) starting with the most significant digit is said to be direct reading, while an automaton starting with the least significant digit is reverse reading. The above definition holds whether s(n) is direct or reverse reading.

Substitution Let φ be a k-uniform morphism of a free monoid Σ∗ and let τ be a coding (that is, a 1-uniform morphism), as in the automata-theoretic case. If w is a fixed point of φ—that is, if w=φ(w)—then s=τ(w) is a k-automatic sequence. Conversely, every k-automatic sequence is obtainable in this way. This result is due to Cobham, and it is referred to in the literature as Cobham's little theorem.

k-kernel Let k ≥ 2. The k-kernel of the sequence s(n) is the set of subsequences

Kk(s)={s(ken+r):e≥0 and 0≤r≤ke−1}. In most cases, the k-kernel of a sequence is infinite. However, if the k-kernel is finite, then the sequence s(n) is k-automatic, and the converse is also true. This is due to Eilenberg. It follows that a k-automatic sequence is necessarily a sequence on a finite alphabet.

Formal power series Let u(n) be a sequence over an alphabet Σ and suppose that there is an injective function β from Σ to the finite field Fq, where q = pn for some prime p. The associated formal power series is

∑i≥0β(u(i))Xi. Then the sequence u is q-automatic if and only if this formal power series is algebraic over Fq(X). This result is due to Christol, and it is referred to in the literature as Christol's theorem.

History Automatic sequences were introduced by Büchi in 1960, although his paper took a more logico-theoretic approach to the matter and did not use the terminology found in this article. The notion of automatic sequences was further studied by Cobham in 1972, who called these sequences "uniform tag sequences". The term "automatic sequence" first appeared in a paper of Deshouillers.

Examples The following sequences are automatic:

Thue–Morse sequence

The Thue–Morse sequence t(n) (OEIS: A010060) is the fixed point of the morphism 0 → 01, 1 → 10. Since the n-th term of the Thue–Morse sequence counts the number of ones modulo 2 in the base-2 representation of n, it is generated by the two-state deterministic finite automaton with output pictured here, where being in state q0 indicates there are an even number of ones in the representation of n and being in state q1 indicates there are an odd number of ones. Hence, the Thue–Morse sequence is 2-automatic.

Period-doubling sequence The n-th term of the period-doubling sequence d(n) (OEIS: A096268) is determined by the parity of the exponent of the highest power of 2 dividing n. It is also the fixed point of the morphism 0 → 01, 1 → 00. Starting with the initial term w = 0 and iterating the 2-uniform morphism φ on w where φ(0) = 01 and φ(1) = 00, it is evident that the period-doubling sequence is the fixed-point of φ(w) and thus it is 2-automatic.

Rudin–Shapiro sequence The n-th term of the Rudin–Shapiro sequence r(n) (OEIS: A020985) is determined by the number of consecutive ones in the base-2 representation of n. The 2-kernel of the Rudin–Shapiro sequence is

r(2n)=r(n),r(4n+1)=r(n),r(8n+7)=r(2n+1),r(16n+3)=r(8n+3),r(16n+11)=r(4n+3). Since the 2-kernel consists only of r(n), r(2n + 1), r(4n + 3), and r(8n + 3), it is finite and thus the Rudin–Shapiro sequence is 2-automatic.

Other sequences Both the Baum–Sweet sequence (OEIS: A086747) and the regular paperfolding sequence (OEIS: A014577) are automatic. In addition, the general paperfolding sequence with a periodic sequence of folds is also automatic.

Properties Automatic sequences exhibit a number of interesting properties. A non-exhaustive list of these properties is presented below.

Every automatic sequence is a morphic word. For k ≥ 2 and r ≥ 1, a sequence is k-automatic if and only if it is kr-automatic. This result is due to Eilenberg. For h and k multiplicatively independent, a sequence is both h-automatic and k-automatic if and only if it is ultimately periodic. This result is due to Cobham also known as Cobham's theorem, with a multidimensional generalisation due to Semenov. If u(n) is a k-automatic sequence over an alphabet Σ and f is a uniform morphism from Σ∗ to another alphabet Δ∗, then f(u) is a k-automatic sequence over Δ. If u(n) is a k-automatic sequence, then the sequences u(kn) and u(kn − 1) are ultimately periodic. Conversely, if u(n) is an ultimately periodic sequence, then the sequence v defined by v(kn) = u(n) and otherwise zero is k-automatic. A real number with an automatic decimal expansion in a given base is either rational or transcendental. A real number with an automatic continued fraction expansion is either quadratic irrational or transcendental.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Automatic sequence

Start with the simplest possible case. Write down what Automatic sequence 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 Automatic sequence 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 Automatic sequence 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 Automatic sequence

In research
Automatic sequence 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 Automatic sequence 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
Automatic sequence is common in secondary-school and first-year university syllabi. It links to neighbouring topics Automata (computation), Combinatorics on words, Integer sequences, so understanding it makes those chapters shorter.
In everyday life
Look for Automatic sequence 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 “Automatic sequence” →

How to study Automatic sequence in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Automatic sequence 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 Automatic sequence out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Automatic sequence in simple terms?

In mathematics and theoretical computer science, an automatic sequence (also called a k-automatic sequence or a k-recognizable sequence when one wants to indicate that the base of the numerals used is k) is an infinite sequence of terms characterized by a finite automaton. The n-th term of an autom…

Why does Automatic sequence 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 Automatic sequence?

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 Automatic sequence.

Tags

  • Automata (computation)
  • Combinatorics on words
  • Integer sequences

Keep exploring