De Bruijn torus


In combinatorial mathematics, a De Bruijn torus, named after Nicolaas Govert de Bruijn, is an array of symbols from an alphabet that contains every m-by-n matrix exactly once. It is a torus because the edges are considered wraparound for the purpose of finding matrices. Its name comes from the De Bruijn sequence, which can be considered a special case where n is 1.
One of the main open questions regarding De Bruijn tori is whether a De Bruijn torus for a particular alphabet size can be constructed for a given m and n. It is known that these always exist when n = 1, since then we simply get the De Bruijn sequences, which always exist. It is also known that "square" tori exist whenever m = n and even.
The smallest possible binary "square" de Bruijn torus, depicted above right, denoted as 2 de Bruijn torus, contains all 2×2 binary matrices.

''B2''

Apart from "translation", "inversion" and "rotation", no other 2 de Bruijn tori are possible - this can be shown by complete inspection of all 216 binary matrices .

Larger example: ''B4''

An example of the next possible binary "square" de Bruijn torus, 2, has been explicitly constructed.
The image on the right shows an example of a 2 de Bruijn torus / array, where the zeros have been encoded as white and the ones as red pixels respectively.

Binary de Bruijn tori of greater size

The paper in which an example of the 2 de Bruijn torus was constructed contained over 10 pages of binary, despite its reduced font size, requiring three lines per row of array.
The subsequent possible binary de Bruijn torus, containing all binary 6×6 matrices, would have 236 = 68,719,476,736 entries, yielding a square array of dimension 262,144x262,144, denoted a 2 de Bruijn torus or simply B6. This could easily be stored on a computer—if printed with pixels of side 0.1 mm, such a matrix would require an area of approximately 26×26 square metre.
The object B8, containing all binary 8×8 matrices and denoted 2, has a total of 264 ≈ 18.447×1018 entries: storing such a matrix would require 18.5 exabits, or 2.3 Exabyte of storage, an order of magnitude above even modern data centres.