Math 2.0

Computer science Object

De Bruijn sequence

Description

Let k≥1k \ge 1 and n≥1n \ge 1 be integers, and let AA be an alphabet with kk letters. A de Bruijn sequence of order nn over AA is a cyclic word w=a0a1⋯akn−1w = a_0 a_1 \cdots a_{k^n - 1} of length knk^n with the following property. Every word of length nn over AA occurs exactly once as a cyclic factor aiai+1⋯ai+n−1a_i a_{i+1} \cdots a_{i+n-1}, with indices taken modulo knk^n. Such sequences exist for all kk and nn.

Remarks

Example: for k=2k = 2 and n=3n = 3, the word 0001011100010111 is a de Bruijn sequence. Its eight cyclic factors of length 33, starting at positions 00 to 77, are 000,001,010,101,011,111,110,100000, 001, 010, 101, 011, 111, 110, 100. These are all the 23=82^3 = 8 binary words of length 33, each once.

Existence follows from graph theory. The de Bruijn graph is the directed graph whose vertices are the words of length n−1n - 1, and in which each word a1⋯ana_1 \cdots a_n is an edge from a1⋯an−1a_1 \cdots a_{n-1} to a2⋯ana_2 \cdots a_n. Each vertex has in-degree and out-degree kk, and the graph is strongly connected. By the directed form of Euler's theorem, it has an Eulerian circuit. Reading the last letters of the edges along this circuit gives a de Bruijn sequence.

The number of distinct de Bruijn sequences of order nn over kk letters, counted as cyclic words, is (k!)kn−1/kn(k!)^{k^{n-1}} / k^n. For k=2k = 2 and n=3n = 3 this is 24/8=22^4 / 8 = 2: the words 0001011100010111 and 0001110100011101.

Further reading

  1. Web https://en.wikipedia.org/wiki/De_Bruijn_sequence
About this page
TagGY8F3M39R8
URIm2://GY8F3M39R8
Kindobject
WritingW0 stub
MSC68R15, 05A05, 05C45
Same as
Changed2 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.