Automatic Sequences
and why I am interested
Wieb Bosma
Radboud Universiteit Nijmegen
Streams Seminar
25 January 2011
Nijmegen, 25 January 2011 0
disclaimer
Most material taken from book Automatic Sequences by Jean-Paul Allouche and
Jeffrey Shallit (Cambridge University Press, 2003), and paper Number theory and
formal languages by J.O. Shallit, (Springer 1999).
Automatic sequences form a class of sequences somewhere between simpleorder and chaotic disorder.
Nijmegen, 25 January 2011 1
automata
A deterministic finite automaton starts in a distinguished initial state, reads letters
from a finite input word, which determine transitions to finite number of states, to
end in one of the final states, which is either accepting or rejecting for the input word.
A = (Q,Σ, δ, q0, F ):
Q finite set of states,
Σ finite alphabet,
δ : Q× Σ→ Q transitions,
q0 ∈ Q initial state,
F ⊂ Q accepting states.
Nijmegen, 25 January 2011 3
answers
Theorem 1 A language is accepted by a deterministic finite state automaton if and
only if it can be specified by a regular expression.
Theorem 2 There is a unique deterministic finite state automaton with minimal
number of states accepting a given regular language.
Nijmegen, 25 January 2011 5
generalizations
A non-deterministic finite state automaton allows any finite number (including
zero) of transitions from a state for a given input letter. A word is accepted if and
only if there exists a choice of transitions leading to an accepting state.
A deterministic finite state automaton with output produces an output symbol at
final states (instead of a Boolean), and hence defines a finite state function from Σ∗
to (a possibly different output alphabet) ∆.
A transducer produces a word over the output alphabet ∆ for every transition
(q, a) ∈ Q× Σ. It is uniform if all output words have the same length.
Nijmegen, 25 January 2011 6
sequences
A sequence (an)n≥0 is a k-automatic sequence if there exists a deterministic finite
state automaton which produces for all n ≥ 0 on input the base-k representation [n]kof n, the element an as output.
Nijmegen, 25 January 2011 9
example
Define the Thue-Morse sequence (tn)n≥0 by tn =∑∞
i=0 di mod 2 if n =∑∞
i=0 di2i
is the binary expansion of n. It starts 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, . . ..
Theorem 3 The Thue-Morse sequence is 2-automatic.
Nijmegen, 25 January 2011 10
example
Define the Rudin-Shapiro sequence (rn)n≥0 by rn = 1 or −1 according to whether
the number of pairs of consecutive 1’s in the binary expansion of n is even or odd. It
starts 1, 1, 1,−1, 1, 1,−1, 1, 1, 1, 1,−1, . . ..
Theorem 4 The Rudin-Shapiro sequence is 2-automatic.
Nijmegen, 25 January 2011 11
example
Define the Baum-Sweet sequence (bn)n≥0 by bn = 1 or 0 according to whether the
number of blocks of odd length of consecutive 0’s in the binary expansion of n is
zero or positive. It starts 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1 . . ..
Theorem 5 The Baum-Sweet sequence is 2-automatic.
Nijmegen, 25 January 2011 12
characterisations
For positive integer k and output letter d, define the fiber Ik(a, d) of the sequence a
as the set of input words [n]k such that an = d.
Theorem 6 a is k-automatic if and only if every Ik(a, d) is a regular language.
Define the k-kernel of a to be the set of subsequences
{(aki·n+j)n≥0 : i ≥ 0, 0 ≤ j < ki}.
Theorem 7 a is k-automatic if and only if the k-kernel is finite.
Nijmegen, 25 January 2011 13
bases
Theorem 8 If (an)n≥0 is ultimately periodic, then it is k-automatic for all k ≥ 2.
Theorem 9 (an)n≥0 is ultimately periodic if and only if it is 1-automatic.
Theorem 10 (Cobham) (an)n≥0 is ultimately periodic if it is k- and l-automatic,
for multiplicatively independent k, l ≥ 2.
Nijmegen, 25 January 2011 14
morphisms
A k-uniform morphism is a map φ : Σ∗ → Σ∗ such that φ(xy) = φ(x)φ(y) for all
words x, y and such that the length of φ(a) is k for all letters a ∈ Σ.
If φ(a) = ax for some letter a then
φω(a) = axφ(x)φ2(x) · · ·
is the unique fixed point of φ starting with a.
Theorem 11 (Cobham) a is a k-automatic sequence if and only if it is fixed point
of a k-uniform morphism (followed by a coding).
Nijmegen, 25 January 2011 15
example
The Thue-Morse sequence is the fixed point of φ defined by φ(0) = 01 and
φ(1) = 10. Indeed,
01φ(1)φ2(1)φ3(1) · · · = 0110100110010110 · · · .
The Baum-Sweet sequence is obtained from the fixed point of
φ(a) = ab, φ(b) = cb, φ(c) = bd, φ(d) = dd,
followed by replacing a, b by 1 and c, d by 0. Indeed, we obtain
abcbbdcbcbddbdcb · · · ,
which becomes
1101100101001001 · · · .
Nijmegen, 25 January 2011 16
morphic
Theorem 12 The image of an automatic sequence under a uniform transducer is
again automatic.
A morphic sequence is the fixed point of a morphism (after a coding).
The infinite Fibonacci word is the morphic sequence that is the fixed point of
φ(0) = 01 and φ(1) = 0. We get
f = 010010100100101001010 · · · .
Theorem 13 The image of a morphic sequence under a transducer is finite or again
a morphic sequence.
Nijmegen, 25 January 2011 17
fractions
Regular continued fractions for real numbers are of the form
a0 +1
a1 +1
a2 +1
a3 +1
. . .
with positive integers ai. Denoted [a0, a1, a2, a3, . . .].
(In)finite continued fractions represent (ir)rational numbers.
For irrational x the infinite sequence of ai is obtained by putting x0 = x and
repeating
ai = bxic, xi+1 =1
xi − ai.
Alternative (semi-regular) continued fraction expansions are obtained by rounding
differently.
Nijmegen, 25 January 2011 20
approximation
Important because this furnishes infinite sequence of (best) rational approximations
by the convergentspn
qn= [a0, a1, a2, . . . , an],
each satisfying ∣∣∣∣x− pn
qn
∣∣∣∣ < 1q2n.
Theorem 14 The regular continued fraction expansion of x is ultimately periodic if
and only if x is a quadratic irrational number.
For example, √67 = [8, 5, 2, 1, 1, 7, 1, 1, 2, 5, 16].
Nijmegen, 25 January 2011 21
transcendental
This automaton generates the continued fraction expansion of
f(B) =∞∑
k=0
1B2k ,
a transcendental number, for any integer B ≥ 3.
Nijmegen, 25 January 2011 22
conjecture
Thus we find two classes and lots of examples of real numbers having bounded
partial quotients: the rational numbers (finite) and the quadratic irrationalities
(ultimately periodic) and some transcendental numbers.
Conjecture 1 If a real number x has bounded partial quotients then it is either
rational, quadratic irrational, or transcendental.
Note: this is no longer true for complex continued fractions!
There are also interesting questions related to sums of real numbers with bounded
partial quotients: M. Hall proved that every real number in the unit interval is the
sum of two reals with partial quotients at most 4.
Nijmegen, 25 January 2011 24
arithmetic
Unfortunately, continued fraction representations are hopeless for doing arithmetic.
The main result is by Raney.
Theorem 15 For integers a, b, c, d with ad− bc 6= 0, there exits a finite transducer
that, on input the regular continued fraction representation of x, produces the
continued fraction representation of
y =ax+ b
cx+ d.
Nijmegen, 25 January 2011 25
Farey
Raney uses the LR-representation, which is closely related to Farey-fractions and the
Stern-Brocot representation for reals.
The numerators pn and denominators qn for the convergents of x = [a0, a1, a2, . . .]satisfy the same recursion
pn = anpn−1 + pn−2, qn = anqn−1 + qn−2,
if we put
p−1 = 0, p−2 = 1, q−1 = 1, q−2 = 0.
Nijmegen, 25 January 2011 27
LR
It turns out that matrices like pn+1 pn
qn+1 qn
can be written as product
La0Ra1La2 · · ·Lan
(or a slight variant, depending on the parity of n) where
L =
1 0
1 1
, R =
1 1
0 1
,
so
Lai =
1 0
ai 1
, Raj =
1 aj
0 1
.
Nijmegen, 25 January 2011 28
Christol
Let (an)n≥0 be a sequence over the finite alphabet ∆, let p be a prime number, and
Fpm the finite field of pm elements..
Theorem 16 (Christol) (an)n≥0 is p-automatic if and only if there exist a positive
integer m and an injection ι of ∆ in Fpm such that
∞∑k=0
ι(ak)Xk
is algebraic over Fpm(X).
Nijmegen, 25 January 2011 30
example
Let (tn)n≥0 be the Thue-Morse sequence again, and
T (X) =∞∑
k=0
tkXk ∈ F2[[X]].
Since t2n+1 = tn + 1 we find
T (X) =∞∑
k=0
t2kX2k +X
∞∑k=0
(tk + 1)X2k
and hence
T (X) = T (X)2 +XT (X)2 +X1
1−X2,
so T satisfies
(1 +X)3T 2 + (1 +X)2T +X = 0.
Nijmegen, 25 January 2011 31
references
Jean-Paul Allouche, Jeffrey Shallit, Automatic Sequences, Cambridge University
Press, 2003
J.O. Shallit, Number theory and formal languages, in: Emerging applicationsof number theory, pp. 547–570, Springer, 1999.
Richard K. Guy, Conway’s prime producing machine, Math. Mag. 56 (1983),
26–33.
Doug Hensley, Continued Fractions, World Scientific, 2006.
Marshall Hall, Jr., On the sum and product of continued fractions, Ann. Math.
48 (1947), 966–993.
George N. Raney, On continued fractions and finite automata, Math. Ann.
206 (1973), 265–283.
Nijmegen, 25 January 2011 32