ArticleslgStudy

computer science

K-regular sequence

K-regular 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 K-regular sequence rather than just read about it. In short: In mathematics and theoretical computer science, a k-regular sequence is a sequence satisfying linear recurrence equations that reflect the base-k representations of the integers. The class of k-regular sequences generalizes the class of k-automatic sequences to alphabets of infinite size.

Key takeaways

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

Reference excerpt

In mathematics and theoretical computer science, a k-regular sequence is a sequence satisfying linear recurrence equations that reflect the base-k representations of the integers. The class of k-regular sequences generalizes the class of k-automatic sequences to alphabets of infinite size.

Definition There exist several characterizations of k-regular sequences, all of which are equivalent. Some common characterizations are as follows. For each, we take R′ to be a commutative Noetherian ring and we take R to be a ring containing R′.

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

Kk(s)={s(ken+r)n≥0:e≥0 and 0≤r≤ke−1}. The sequence s(n)n≥0 is (R′, k)-regular (often shortened to just "k-regular") if the R′-module generated by Kk(s) is a finitely-generated R′-module. In the special case when R′=R=ℚ, the sequence s(n)n≥0 is k-regular if Kk(s) is contained in a finite-dimensional vector space over ℚ.

Linear combinations A sequence s(n) is k-regular if there exists an integer E such that, for all ej > E and 0 ≤ rj ≤ kej − 1, every subsequence of s of the form s(kejn + rj) is expressible as an R′-linear combination ∑icijs(kfijn+bij), where cij is an integer, fij ≤ E, and 0 ≤ bij ≤ kfij − 1. Alternatively, a sequence s(n) is k-regular if there exist an integer r and subsequences s1(n), ..., sr(n) such that, for all 1 ≤ i ≤ r and 0 ≤ a ≤ k − 1, every sequence si(kn + a) in the k-kernel Kk(s) is an R′-linear combination of the subsequences si(n).

Formal series Let x0, ..., xk − 1 be a set of k non-commuting variables and let τ be a map sending some natural number n to the string xa0 ... xae − 1, where the base-k representation of x is the string ae − 1...a0. Then a sequence s(n) is k-regular if and only if the formal series ∑n≥0s(n)τ(n) is ℤ-rational.

Automata-theoretic The formal series definition of a k-regular sequence leads to an automaton characterization similar to Schützenberger's matrix machine.

History The notion of k-regular sequences was first investigated in a pair of papers by Allouche and Shallit. Prior to this, Berstel and Reutenauer studied the theory of rational series, which is closely related to k-regular sequences.

Examples

Ruler sequence Let s(n)=ν2(n+1) be the 2-adic valuation of n+1. The ruler sequence s(n)n≥0=0,1,0,2,0,1,0,3,… (OEIS: A007814) is 2-regular, and the 2-kernel

{s(2en+r)n≥0:e≥0 and 0≤r≤2e−1} is contained in the two-dimensional vector space generated by s(n)n≥0 and the constant sequence 1,1,1,…. These basis elements lead to the recurrence relations

s(2n)=0,s(4n+1)=s(2n+1)−s(n),s(4n+3)=2s(2n+1)−s(n), which, along with the initial conditions s(0)=0 and s(1)=1, uniquely determine the sequence.

Thue–Morse sequence The Thue–Morse sequence t(n) (OEIS: A010060) is the fixed point of the morphism 0 → 01, 1 → 10. It is known that the Thue–Morse sequence is 2-automatic. Thus, it is also 2-regular, and its 2-kernel

{t(2en+r)n≥0:e≥0 and 0≤r≤2e−1} consists of the subsequences t(n)n≥0 and t(2n+1)n≥0.

Cantor numbers The sequence of Cantor numbers c(n) (OEIS: A005823) consists of numbers whose ternary expansions contain no 1s. It is straightforward to show that

c(2n)=3c(n),c(2n+1)=3c(n)+2, and therefore the sequence of Cantor numbers is 2-regular. Similarly the Stanley sequence

0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31, 36, 37, 39, 40, ... (sequence A005836 in the OEIS) of numbers whose ternary expansions contain no 2s is also 2-regular.

Sorting numbers A somewhat interesting application of the notion of k-regularity to the broader study of algorithms is found in the analysis of the merge sort algorithm. Given a list of n values, the number of comparisons made by the merge sort algorithm are the sorting numbers, governed by the recurrence relation

T(1)=0,T(n)=T(⌊n/2⌋)+T(⌈n/2⌉)+n−1, n≥2. As a result, the sequence defined by the recurrence relation for merge sort, T(n), constitutes a 2-regular sequence.

Other sequences If f(x) is an integer-valued polynomial, then f(n)n≥0 is k-regular for every k≥2. The Glaisher–Gould sequence is 2-regular. The Stern–Brocot sequence is 2-regular. Allouche and Shallit give a number of additional examples of k-regular sequences in their papers.

Properties k-regular sequences exhibit a number of interesting properties.

Every k-automatic sequence is k-regular. Every k-synchronized sequence is k-regular. A k-regular sequence takes on finitely many values if and only if it is k-automatic. This is an immediate consequence of the class of k-regular sequences being a generalization of the class of k-automatic sequences. The class of k-regular sequences is closed under termwise addition, termwise multiplication, and convolution. The class of k-regular sequences is also closed under scaling each term of the sequence by an integer λ. In particular, the set of k-regular power series forms a ring. If s(n)n≥0 is k-regular, then for all integers m≥1, (s(n)modm)n≥0 is k-automatic. However, the converse does not hold. For multiplicatively independent k, l ≥ 2, if a sequence is both k-regular and l-regular, then the sequence satisfies a linear recurrence. This is a generalization of a result due to Cobham regarding sequences that are both k-automatic and l-automatic. The nth term of a k-regular sequence of integers grows at most polynomially in n. If F is a field and x∈F, then the sequence of powers (xn)n≥0 is k-regular if and only if x=0 or x is a root of unity.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with K-regular sequence

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

In research
K-regular 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 K-regular 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
K-regular 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 K-regular 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 “K-regular sequence” →

How to study K-regular sequence in 20 minutes

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

Frequently asked questions

What is K-regular sequence in simple terms?

In mathematics and theoretical computer science, a k-regular sequence is a sequence satisfying linear recurrence equations that reflect the base-k representations of the integers. The class of k-regular sequences generalizes the class of k-automatic sequences to alphabets of infinite size.

Why does K-regular 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 K-regular 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 K-regular sequence.

Tags

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

Keep exploring