Next Article in Journal
Cellular Automata-Based Methods for the Construction of Mutually Unbiased Bases
Previous Article in Journal
Research on Emotion-Based Inspiration Mechanism in Art Creation by Generative AI
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Rule-Based Generation of de Bruijn Sequences: Memory and Learning

by
Francisco J. Muñoz
1,* and
Juan Carlos Nuño
2
1
Departamento de Matemática Aplicada, Ciencia e Ingeniería de Materiales y Tecnología Electrónica, Universidad Rey Juan Carlos, Móstoles, 28933 Madrid, Spain
2
Departamento de Matemática Aplicada, Universidad Politécnica de Madrid, 28040 Madrid, Spain
*
Author to whom correspondence should be addressed.
Mathematics 2025, 13(16), 2598; https://doi.org/10.3390/math13162598
Submission received: 13 July 2025 / Revised: 6 August 2025 / Accepted: 12 August 2025 / Published: 14 August 2025
(This article belongs to the Section E: Applied Mathematics)

Abstract

We investigate binary sequences generated by non-Markovian rules with memory length μ , similar to those adopted in elementary cellular automata. This generation procedure is equivalent to a shift register, and certain rules produce sequences with maximal periods, known as de Bruijn sequences. We introduce a novel methodology for generating de Bruijn sequences that combines (i) a set of derived properties that significantly reduce the space of feasible generating rules and (ii) a neural-network-based classifier that identifies which rules produce de Bruijn sequences. The experiments for some values of μ demonstrate the approach’s effectiveness and computational efficiency.

1. Introduction

Cellular automata (CA) are a class of dynamical systems that evolve in discrete time and space [1,2]. A CA consists of cells (or agents), each of which can adopt a state from a discrete set. The most commonly used alphabet is binary, typically denoted by { 0 , 1 } . The CA evolves by applying generating rules at each time step. These rules can be static or dynamic (i.e., they may change depending on the current state of the entire CA) and either local or global, depending on whether they involve only neighboring cells or the entire population.
From an initial configuration, the state of the CA evolves over time according to the specified rules. The update rule for each cell can depend on both the past states of the cell itself (temporal dimension) and the states of its neighboring cells (spatial dimension). Elementary one-dimensional cellular automata (1dCA) typically assume a memoryless structure with a linear topology, where each cell interacts only with its nearest neighbors [1]. More complex models incorporate memory—i.e., dependence on a set of past states—and long-range spatial influences [3,4].
Relatively less attention has been given to zero-dimensional cellular automata (0dCA), which consist of a single cell whose state is updated based solely on its own past states. Despite their apparent simplicity, 0dCA do not involve interactions between multiple cells, their time evolution yields interesting sequences of symbolic states. The rules governing such systems depend on the memory μ —the number of previous states influencing the next state—and the alphabet { α } , the number of possible states a cell can take. Generally, the complexity of the system increases with both μ and α . For simplicity, we focus on binary systems, i.e., α = 2 , using the symbols { 0 , 1 } , and, due to computational limitations, we restrict our study to a subset of cases with relatively low values of μ (less than 8).

2. 0-Dimensional CA

Symbolic sequences naturally arise in discrete dynamical systems, e.g., CA [5]. From an initial condition, the next state is computed according to a generation rule (or function) that depends on previous states. For instance, a classical non-Markovian binary time series can be defined by initial values a 1 and a 2 and a recursive rule:
a k + 2 = ( a k + 1 + a k ) mod 2 , for k = 1 , 2 ,
With initial states a 1 = 0 and a 2 = 1 , the sequence continues as a 3 = 1 , a 4 = 0 , a 5 = 1 , a 6 = 1 , etc., producing the following binary sequence:
s 1 = 0 1 1 0 1 1 0 1 1 0 1 1 0
This sequence is clearly periodic with period T 1 = 3 . In this case, the next digit depends on the two previous digits, implying a memory μ = 2 .
Other examples with μ = 2 can be constructed using logical operators. For instance, applying the AND-function with the rules
1 1 1 , 1 0 0 , 0 1 0 , 0 0 0
to the initial pair 0 1 produces the sequence
s 2 = 0 1 0 0 0 0 0
Similarly, applying the OR-function
1 1 1 , 1 0 1 , 0 1 1 , 0 0 0
to the same initial configuration 0 1 results in
s 3 = 0 1 1 1 1 1 1
Both sequences converge to fixed values (0 or 1), i.e., their periods are T 2 = T 3 = 1 , and these fixed points are independent of the initial configuration.
In contrast, applying the XOR-function
1 1 0 , 1 0 1 , 0 1 1 , 0 0 0
to the initial state a 1 = 0 , a 2 = 1 yields
s 4 = 0 1 1 0 1 1 0 1 1 0
with period T 4 = 3 . However, using the same rule with the initial configuration a 1 = 0 , a 2 = 0 results in a constant sequence a k = 0 for all k > 2 . These examples illustrate that the resulting behavior depends not only on the rule but also on the initial conditions.
For any finite memory μ < , all sequences generated in this framework are eventually periodic. That is, for any rule and initial condition, the sequence will eventually settle into a repeating pattern (also referred to as a motif or loop). The maximum possible period for a sequence with memory μ is
T max = 2 μ
As μ increases, the sequences may resemble aperiodic ones, making them useful for computing pseudorandom numbers to be applied in Monte Carlo simulations and cryptographic systems [6]. Truly aperiodic behavior can only arise when μ , or when the alphabet is infinite (e.g., using real-valued states).
To explore periodicity in 0dCA, we adopt combinatorial generating rules analogous to those used in 1dCA [1], with memory playing the role of spatial interaction. Formally, a generating rule with memory μ is a function that maps each of the 2 μ binary sequences of length μ to a single binary output:
R ( a 1 , a 2 , , a μ ) = a j
where a i { 0 , 1 } for all i = 1 , 2 , , μ (see Figure 1). Starting from an initial configuration, the rule is applied recursively to generate the digits of the sequence as follows:
a j + 1 = R ( a j μ + 1 , a j μ + 2 , , a j )
which eventually converges to an asymptotic pattern with period T.
For example, when μ = 3 , there are 2 2 3 = 256 possible rules—corresponding to Wolfram’s elementary 1dCA rules. Figure 1A shows the XOR rule for μ = 3 , represented by the binary rule string 10010110, which corresponds to rule number 150 in Wolfram’s classification. Applying this rule to the initial configuration 0 1 0 yields
s 5 = 0 1 0 1 0 1 0 1 0
which has period T 5 = 2 .
In general, for a given μ = 1 , 2 , 3 , , the total number of possible generating rules is C ( μ ) = 2 2 μ (this number corresponds with the Fermat number minus 1 [7]), and the maximum number of binary sequences generated from these rules is 2 2 μ + μ . This number grows super-exponentially with μ , making exhaustive analysis computationally infeasible for large μ . For instance, when μ = 10 , there are approximately 10 308 rules, each of which must be applied to 1024 different initial configurations.
This raises the following fundamental question: given a memory value μ and an initial configuration, is it possible to predict the asymptotic pattern and period T of the resulting sequence? While this is tractable for small μ via exhaustive enumeration, alternative methods are necessary for large μ due to the sheer size of the rule space.
It is worth noting that the 0-dimensional cellular automata (0dCA) with memory, as defined above, are equivalent to sequences generated by a Non-Linear Feedback Shift Register (NLFSR). This type of sequence has been extensively studied, and a vast body of literature exists on the subject [8,9,10,11]. In particular, significant attention has been devoted to the characterization and computation of shift register sequences with maximum period—commonly known as de Bruijn sequences [12,13,14,15]. As we will show in the next section, there exists a one-to-one correspondence between de Bruijn sequences and their generating rules, which we will refer to as de Bruijn rules.

3. Rules That Generate Maximum Period Sequences: De Bruijn Rules

For a given memory length μ , the maximum period that a generated binary sequence can attain is T max = 2 μ . Naturally, the minimum period is 1, corresponding to sequences that converge to fixed points (e.g., either 0 or 1). For small values of μ , it is feasible to generate all possible sequences and compute their corresponding periods. For μ = 4 , Table 1 shows the number of rules that generate sequences with periods in between 1 and 2 4 for each of the 2 4 initial sequence of length 4. Note that the distributions of periods are symmetric to middle rows and that the maximum period occurs for only 16 rules, independently of the initial sequence. The proportion of rules as a function of the maximum period of the sequences that each of the 2 2 4 generates over all the initial sequences is depicted in Figure 2 (also for the case μ = 4 ). It is worthy to remark the nonmonotonous shape of this distribution that exhibits three relative maxima at periods T = 1 , T = 3 , and T = 5 . For T > 5 , it seems to decrease exponentially.
Sequences with a maximum period, known as de Bruijn sequences, are of particular interest. These are cyclic sequences of length 2 μ in which every possible binary substring of length μ appears exactly once. For small values of μ , it is straightforward to generate all possible de Bruijn sequences. There exists a unique de Bruijn sequence for μ = 2 , namely, 0011. For μ = 3 , there are two such sequences: 00010111 and 00011101 that are generated by rules 45 and 75, respectively (rule 45 is graphically described in Figure 1B).
Since these sequences are cyclic, their representations are not unique; by convention, we select the lexicographically least sequence (i.e., the smallest in binary order and decimal number) as the representative of the equivalence class. Specially significative is the lexicographically least sequence for each memory μ that is referred to as the granddaddy in [16].
The number of binary de Bruijn sequences for a given μ is given by C ( μ ) = 2 2 μ 1 μ  [12,17]. This number grows also superexponentially with μ and reaches extremely large values even for moderate μ . For example, for μ = 10 , C ( 10 ) 10 151 . Generating all de Bruijn sequences is a challenging combinatorial problem that remains unsolved in full generality, though various efficient construction algorithms have been proposed (see, for instance, [18,19]).
De Bruijn sequences can be generated by applying certain specific rules, independently of the initial configuration of length μ . In other words, there exists a bijection between de Bruijn sequences and their corresponding rules, which we refer to as de Bruijn rules. Table 2 lists the de Bruijn rules and their de Bruijn sequences for μ = 1 , 2 , 3 , and 4, expressed both as binary maps and in their corresponding decimal representations.
For μ = 4 , there are C ( 4 ) = 2 2 3 4 = 16 de Bruijn rules and their associated de Bruijn sequences. As it can be seen, the granddaddy sequence is 0000100110101111. The corresponding granddaddy rule is 3825, with binary representation 0000111011110001. For μ = 5 , the number of de Bruijn sequences is C ( 5 ) = 2 2 4 5 = 2048 . The granddaddy rule in this case is 00001100111111101111001100000001 (whose decimal representation is 218,034,945), which generates the granddaddy sequence 00000100011001011011101010011111.

4. Characterization of de Bruijn Rules

As stated in the previous section, certain generating rules produce sequences with maximum period—we refer to them as de Bruijn rules. Therefore, a complete characterization of such rules emerges as a fundamental goal. The following properties help identify and constrain the set of de Bruijn rules and can be used to systematically search for them:
  • Boundary Conditions: The binary representations of de Bruijn rules must start with 0 and end with 1. This condition arises from the convention in rule ordering, which arranges input strings from the highest binary value ( 11 11 ) to the lowest ( 00 00 ) and from the necessity to avoid fixed points (e.g., if R ( 11 11 ) = 1 , the sequence remains constant). This constraint immediately reduces the number of candidate rules by a factor of 4. For example, for μ = 4 , the number of potentially valid rules is reduced from 2 2 4 = 65,536 to 16,384.
  • Symmetry and Parity: The binary representations of de Bruijn rules are symmetric with respect to their midpoint, such that each half is the complement of the other. This symmetry ensures parity: the number of 0s equals the number of 1s, although the balance may be broken within each half. Under this constraint, valid de Bruijn rules correspond to multiples of certain Numbers derived from sequences of Evil Odd numbers [20], multiplied by factors denoted as ϕ ( μ ) (see Appendix A). Let R μ be a rule for a given μ . Then,
    R μ = ϕ ( μ ) ( A + 1 )
    In Appendix A, we show that the factor ϕ ( μ ) is
    ϕ ( μ ) = 2 2 μ 1 1
    For instance, ϕ ( 2 ) = 3 , ϕ ( 3 ) = 15 , ϕ ( 4 ) = 255 , and ϕ ( 5 ) = 65,535. The consideration of this property causes a huge reduction in the feasible set of the de Bruijn rules, from 16,384 to 64 for the case μ = 4 .
  • Evil Odd Number divisibility
    It is also empirical evidence that factor A + 1 in Equation (5) must be an Evil Odd Number for R μ to be a de Bruijn rule. For each μ , there is a unique ϕ that divides R μ , which results in multiple remainders that are Evil Odd Numbers. To consider that, it is convenient to denote this factor as A ( μ ) k , representing the Evil Odd Numbers for k = 1 , 2 , , C ( μ ) . For instance,
    A ( 2 , 1 ) = 1 × 3 = 3 , A ( 3 , 1 ) = 3 × 15 = 45 , A ( 3 , 2 ) = 5 × 15 = 75
    Table 2 presents all de Bruijn rules for μ = 4 whose decimal representations are products of an Evil Odd Number and the corresponding ϕ ( μ ) . Note, however, that not all Evil Odd Numbers yield valid de Bruijn rules, and the problem of determining which ones do remains open for larger values of μ . For μ = 4 , applying these conditions reduce the feasible set of de Bruijn rules to 32.
  • Constrained Position Pairs: There exist pairs of positions in the binary representation of de Bruijn rules that cannot simultaneously take the same value (1 for even μ -values and 0 for odd ones). This condition is applied only to the first half of the binary string for symmetry (according to the previous item) and depends on μ according to a recursive pattern.
    Let p μ j be the binary value of the j position in a de Bruijn rule of memory μ . For μ = 2 , the constrained positions are p 2 1 = 1 and p 2 2 = 2 p 2 1 , and
    If μ = 2 k + 1 , then p 2 k + 1 1 = p 2 k 2 and p 2 k + 1 2 = 2 p 2 k + 1 1 1 .
    If μ = 2 ( k + 1 ) , then p 2 ( k + 1 ) 1 = p 2 k + 1 2 and p 2 ( k + 1 ) 2 = 2 p 2 ( k + 1 ) 1 .
    for k = 1 , 2 , .
    This structural condition eliminates 1 / 4 of the remaining candidates. For example, for μ = 3 , these positions are p 3 1 = 2 and p 3 2 = 3 . For μ = 4 , p 4 1 = 3 and p 4 2 = 6 , and for μ = 5 , p 5 1 = 6 and p 5 2 = 11 .
    Remarkably, for μ = 4 , the final count of feasible de Bruijn rules after applying all constraints is 24. In general, for all values of μ > 3 , the feasible set exceeds the actual number of de Bruijn rules (see Table 3).
  • Symmetric Rule Invariance: If a rule of the form
    0 a 1 a 2 a k 1 a k 0 1 1 a 1 1 a 2 1 a k 1 1 a k 1
    is a de Bruijn rule, then its mirrored version
    0 a k a k 1 a 2 a 1 0 1 1 a k 1 a k 1 1 a 2 1 a 1 1
    is also a de Bruijn rule.
    This property reflects the inherent symmetry and reversibility in de Bruijn rule structure. It ensures that for each valid de Bruijn rule constructed in this way, a corresponding reverse-complement rule also exists within the de Bruijn set.
Let us summarize the reduction procedure that results from the application of these properties for the case μ = 4 . There are 65,536 rules that are filtered as follows:
  • After applying the boundary conditions, 16,384 rules remain feasible.
  • Applying symmetry, i.e., dividing by ϕ ( 4 ) = 255 , 64 rules remain.
  • The requirement that the remainder is an Evil Odd Number reduces the previous number to 32 rules.
  • Verifying the constrained position pairs reduces the feasible set to 24 rules.
From these 24 feasible rules, only 16 are de Bruijn (see Table 2).
The application of the properties stated in the previous paragraphs to the entire set of generating rules significantly reduces the number of feasible rules that can yield de Bruijn sequences (an example can be found in Appendix C). Table 3 presents the total number of rules, the number of de Bruijn sequences, the number of feasible rules after applying the constraints, and the corresponding ratios. As can be observed, the number of feasible rules that need to be checked to find de Bruijn rules is drastically smaller than the total number of rules for each μ value. For instance, when μ = 6 , the reduction factor is approximately 10 11 . In the same case, the ratio between the number of rules that actually yield de Bruijn sequences and the number of feasible rules is around 0.17 . For such low values of μ , a brute-force approach may still be used to generate all de Bruijn sequences. However, a more efficient and structured methodology will be presented in the next section.

5. Neural Networks to Classify de Bruijn Rules

An alternative approach to identifying de Bruijn rules is to apply machine learning methods. In particular, neural networks are especially well suited for classification tasks [21]. In this section, we present a neural network model for classifying the feasible rules into two categories: de Bruijn rules (coded by 1) and the rest (0). Although classification based on the sequence period is also possible, it would require accounting for dependence on initial conditions. The classification is performed for μ = 5 and μ = 6 (see Table 4).
We implemented a binary classification model using a feedforward neural network in R (version 4.5.0) [22]. The analysis followed these main steps:
  • Data loading and preprocessing: The input data consisted of a character string representing a binary sequence and a binary integer label.
  • Feature extraction: Each rule was split into individual bits transforming the strings into a matrix where each column corresponds to a bit (bit1 to bit 2 μ ). According to the necessary properties of de Bruijn rules (see Section 4), only the first μ / 2 bits were retained for further analysis. The first and the 2 μ 1 bits were also removed because they are necessarily 0.
  • Dataset splitting: The data were randomly split into training (80%) and testing (20%) subsets to evaluate model performance on unseen data. The validation set was chosen to be 20 % of the training set in all cases.
  • Model specification and training: A feedforward neural network was constructed using the keras package (version 2.15.0) with a TensorFlow (version 2.16.0) backend [22,23].
Feedforward neural networks are highly suitable for structured, tabular data, such as the bit vectors extracted from rule representations. They can capture complex, non-linear relationships between input features without requiring explicit feature engineering. In our case, the binary inputs represent discrete features, and their interactions are not trivially captured by simpler linear models. The multi-layer architecture enables hierarchical feature learning, significantly improving classification accuracy.
For the case μ = 5 , the neural network architecture includes the following:
  • An input layer with 14 features (bits);
  • A hidden dense layer with 32 units and ReLU activation;
  • A second hidden dense layer with 16 units and ReLU activation;
  • An output layer with 1 unit and sigmoid activation for binary classification.
The model was compiled using the Adam optimizer (learning rate = 0.001 ), binary cross-entropy loss function, and accuracy as a performance metric. The dataset includes the complete set of 6144 feasible rules, one-third of which are de Bruijn rules (see Table 3). Training was performed over 100 epochs with a batch size of 4. Model evaluation was conducted on the test set by calculating accuracy, sensitivity, and specificity (see Table 4). Class labels were assigned using a threshold of 0.5 on the predicted probabilities. The resulting classifier achieved outstanding performance, with an accuracy exceeding 99% for μ = 5 .
The more challenging case of μ = 6 involves a rule space of size on the order of 10 19 , with approximately 67 million de Bruijn rules (see Table 3). As a matter of fact, we can only use a sample of the total rule space that is randomly analyzed and classified into the two classes. To get this sample of the feasible rule space, we used brute force to generate 1 million de Bruijn rules. In parallel, we generated a larger number of non-de Bruijn feasible rules and randomly selected 1 million of them. Note that the ratio of de Bruijn to feasible rules is about 0.17 (Table 3), which means that approximately 6 million feasible rules must be generated by brute force to obtain 1 million de Bruijn rules.
Optimal results were achieved using a slightly deeper neural network with the following architecture:
  • Three hidden dense layers with 64, 64, and 8 units, respectively;
  • ReLU activations in all hidden layers;
  • A sigmoid output unit for binary classification.
Training used a batch size of 64 and a learning rate of 0.001 . The dataset consists of a sample of 2 × 10 6 feasible rules, half of which are de Bruijn rules. As before, 80% of the dataset was used for training, with 20% used for validation and the remainder for testing. A threshold of 0.5 was again applied to the output probabilities to assign class labels. As shown in Table 4, this model also demonstrated excellent classification metrics.
Once the neural network model is available, any given rule can be evaluated to determine, with high probability, whether it is a de Bruijn rule. If the prediction is positive, the rule is then applied to generate the corresponding binary sequence, which must ultimately be verified to confirm that it satisfies the de Bruijn sequence properties.

6. Discussion

The successive application of updating rules to an initial configuration of { 0 , 1 } generates a binary sequence that becomes asymptotically periodic. The size of the initial configuration depends on the memory of the rule, denoted by μ , which is the number of digits required to update the next one. For large values of μ , the number of possible generating rules becomes so large that an exhaustive analysis of the resulting patterns is infeasible. Particularly relevant is a specific and highly constrained subset of rules that we named as de Bruijn rules and that generate sequences of maximum period, known as de Bruijn sequences. Although these sequences represent only a tiny fraction of the entire set of possible sequences, their sheer number for large μ remains enormous, and the complete and effective generation of all such sequences is still an open problem.
In this paper, we have presented a novel approach to compute de Bruijn sequences that combines two complementary methodologies. First, by exploiting structural properties of de Bruijn rules—i.e., those rules that generate maximum period sequences—a drastic reduction in the full set of candidate rules can be achieved. Table 3 summarizes the reduction ratios for several values of μ . Second, we applied a machine learning approach to this feasible subset in order to accurately identify the de Bruijn rules. As shown in Section 5, the use of a classical neural network model for μ = 5 and 6 allows for a nearly complete classification of the de Bruijn rules in the smaller cases and achieves over 99% and 94% accuracy for μ = 5 and μ = 6 , respectively. Once the de Bruijn rules are identified, the corresponding de Bruijn sequences are straightforward to construct. This would allow one to find the granddaddy sequence that represents the lexicographically smallest member for each μ -value.
The rule-based approach for generating de Bruijn sequences presented in this paper is, to the best of our knowledge, unique in the literature. It employs a hybrid methodology that integrates machine learning techniques within the framework of cellular automata. Specifically, we use rules with memory μ to generate sequences from an initial configuration of μ bits. Rules that generate sequences with a maximum period T = 2 μ —the so-called de Bruijn sequences—are referred to as the de Bruijn rules. By characterizing these rules based on certain empirical properties, we achieve a significant reduction in the overall rule set. However, even after this reduction, a huge set of feasible rules remains for larger μ -values, which still needs to be classified. To address this, we employ a neural network, which has been shown to perform well for μ = 5 and μ = 6 . We believe that further development of this machine learning methodology can yield excellent results for computing de Bruijn sequences with much larger μ -values. It is also worth noting that existing methods based on Nonlinear Feedback Shift Registers have yet to definitively solve the problem. Thus, we consider the results presented in this paper a significant advancement in the study and generation of this important class of sequences.

Author Contributions

Conceptualization, F.J.M. and J.C.N.; Methodology, F.J.M. and J.C.N.; Software, F.J.M. and J.C.N.; Validation, F.J.M. and J.C.N.; Formal analysis, F.J.M. and J.C.N.; Investigation, F.J.M. and J.C.N.; Resources, F.J.M. and J.C.N.; Data curation, F.J.M. and J.C.N.; Writing—original draft, F.J.M. and J.C.N.; Writing—review & editing, F.J.M. and J.C.N. F.J.M. and J.C.N. contributed equally to this manuscript. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The data presented in this study are available on request from the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

In this appendix, we show that a natural number x n whose binary representation of 2 n bits has the form
x n [ a 1 , a 2 , , a n , 1 a 1 , 1 a 2 , , 1 a n ]
for n N and a i { 0 , 1 } are divisible by
M n = 2 n 1
The decimal representation of x n can be written as
x n = i = 1 n a i · 2 2 n i + i = 1 n ( 1 a i ) · 2 n i
which can be manipulated as follows:
x n = i = 1 n a i · 2 2 n i + ( 1 a i ) · 2 n i = i = 1 n a i ( 2 2 n i 2 n i ) + 2 n i = i = 1 n a i · 2 n i ( 2 n 1 ) + i = 1 n 2 n i
The last sum is geometric and can be summed as
i = 1 n 2 n i = 2 n 1 .
and, denotating A = i = 1 n a i · 2 n i , the decimal expression of x n can be rewritten:
x n = ( 2 n 1 ) ( A + 1 )
Therefore, factor M n divides x n for n N .
This result can be applied to a de Bruijn rule with period T = 2 μ . In this case, n = 2 μ 1 , and, then, ϕ ( μ ) = M n = 2 2 μ 1 1 . In this way, we obtain the factors that appear in Table 2:
  • n = 4 μ = 3 and ϕ ( 3 ) = 2 4 1 = 15 = 3 · 5 .
  • n = 8 μ = 4 and ϕ ( 4 ) = 2 8 1 = 255 = 3 · 5 · 17 .
  • n = 16 μ = 5 and ϕ ( 5 ) = 2 16 1 = 65535 = 3 · 5 · 17 · 257 .
  • n = 32 μ = 6 and ϕ ( 6 ) = 2 32 1 = 4294967295 = 3 · 5 · 17 · 257 · 65537 .
The other factors A + 1 are all Evil Odd Numbers [20] as we have shown empirically for low values of μ (see Section 4).
Therefore, the decimal representation of any de Bruijn rule for any μ can be decomposed into two terms, one being ϕ ( μ ) and the other an Evil Odd Number.

Appendix B

The decimal representation of the de Bruijn rules for each μ is divisible for ϕ ( μ ) . The remainder of this division are Evil Odd Numbers. In Table 2, the Evil Odd Numbers corresponding to μ = 2 , 3, and 4 are depicted. In this appendix, we show the Evil Odd Numbers that divide the de Bruijn rules for μ = 5 . In total, there are 2048 Evil Odd Numbers, one for each de Bruijn rule.
Table A1. This table continues Table 2 and depicts the subset of Evil Odd Numbers for μ = 5 . The corresponding ϕ -value is ϕ ( 5 ) = 65 , 535 .
Table A1. This table continues Table 2 and depicts the subset of Evil Odd Numbers for μ = 5 . The corresponding ϕ -value is ϕ ( 5 ) = 65 , 535 .
392599375162457565912710,20312,72913,97716,43118,99320,12722,68923,94125,53126,57329,17330,311
432605376362557571913910,20512,77113,98316,43318,99920,14322,69523,95125,53326,58529,17730,323
452611378962577573914110,22112,77713,99916,43919,00320,15522,70123,96325,58126,65929,22330,341
512617380162637589919910,23312,78514,01116,55119,05320,17522,71323,96525,59326,66529,22930,353
572623380762677593921110,40312,83714,02116,55519,06520,18722,71923,96925,60126,68329,23530,359
632671382363097599921310,40912,84914,03116,55719,07120,23122,75523,97525,60726,72729,24130,375
1652683383563137601921910,42712,85514,03316,56319,11120,23722,75723,98125,61326,73129,24730,387
1692725384563197611922510,47112,90314,03916,56919,11720,24322,76723,98725,62526,73329,28530,407
1752735385563217613924310,47512,91514,04316,57519,12320,24522,76923,98925,63126,73929,29530,419
1772737385763277619925510,47712,96714,05516,67919,12920,24922,77523,99325,63526,74529,29730,469
1832743386763697625925910,48312,97314,06716,68319,13520,26122,77924,00125,63726,75129,30330,479
2932747386963797633926110,48912,97914,08716,68519,18320,27322,82324,00725,64726,91329,30730,481
2972797388563877649926710,49512,98514,09916,69119,19520,30322,82724,01325,64926,92329,34930,491
3032809389764357655927310,65712,99114,10116,69319,23920,31522,82924,01925,65526,93729,36130,493
3052815391764377661927910,66713,02914,11716,80519,24520,31722,83524,02125,65926,98129,36730,509
3152853392964477667928710,68113,03914,12916,80919,25120,33322,83724,02525,66926,98529,41530,521
3172863397564597669929110,72513,04114,14916,81519,25320,34522,88324,07725,67326,99129,42730,535
4232865398164617673929310,72913,04714,16116,81719,25720,35722,88924,08925,67926,99329,47730,541
4272875398764977685929910,73513,05114,21316,82719,31120,36722,89724,09525,68127,00329,48730,547
4292877398965037697930510,73713,09514,22316,82919,32320,36922,94724,11125,68727,00529,48930,549
4352925399365097703931110,74713,10714,22516,94119,32520,37922,94924,12325,70327,17529,49930,553
4372937400565157719934510,74913,10914,23516,95319,36520,38122,95924,13325,70727,18129,50130,565
5592983401765177731935110,91913,15714,23716,95919,37520,39722,97124,14325,70927,18729,54330,577
5712989404765217751935710,92513,16914,25317,07119,37720,40922,97324,14525,71527,19329,54930,599
6852995405965677763936910,93113,22114,26517,08319,38720,42923,00924,15125,72127,19929,55530,611
6972997406165717821937510,93713,23114,27917,19919,38920,44123,01524,15525,72727,24729,55730,613
7033001407765737833937910,94313,23314,28517,21119,43720,51323,02124,16725,73127,25929,56130,629
8133055408965797839938110,99113,24314,29117,21319,44920,52323,02724,17925,73727,42929,60730,641
8253067413165817855939111,00313,24514,29317,32519,45720,53123,02924,19725,75527,43929,61930,661
9433069413366277867939311,17313,28714,29717,33719,46720,64323,03324,20925,76727,44129,62130,673
9553075414366337877939911,18313,29314,30917,41319,47520,64523,08524,21525,77127,45129,66930,753
9573081414566417887940311,18513,29914,32117,41719,49120,65523,09724,23125,77327,45329,68130,759
10313099415166937889941311,19513,30114,49717,42319,49320,65723,10324,24325,77927,50129,69930,765
10353111415567057895941711,19713,30514,50317,42519,50320,66323,14124,26325,78527,51329,70530,777
10373115425767117899942311,24513,31314,50917,43119,50520,66723,15124,27525,79127,65129,72330,783
10433117426767597911942511,25713,31914,52117,44719,51120,77123,15324,33525,79927,65729,73530,819
10493123427567717923943111,39513,32514,52717,45119,51520,77723,15924,34725,80327,67529,73930,821
10553129438568297943944711,40113,33714,56317,45319,52520,78523,16324,34925,80527,68729,74130,831
11573135439168417955945111,41913,34314,56517,45919,52920,89723,20524,36525,81127,69129,74730,833
11613143439768477957945311,43113,34714,57517,46519,53520,90323,21724,37725,81727,69329,75330,839
11673147440368857973945911,43513,34914,57717,47119,53720,90923,22324,39125,82327,69929,75930,843
11693149440568957985946511,43713,35914,58317,54319,54320,91523,27124,39725,85927,70529,76131,011
11753155440968978005947111,44313,36114,58717,54719,55920,91723,28324,40325,86127,71129,77131,013
11913161451569038017947311,44913,36714,75517,54919,56320,92123,34324,40525,87127,71929,77931,023
11953167452169078079948311,45513,37114,75717,55519,56521,02923,35524,40925,88327,72329,79531,035
11973201452969518091949711,46313,37914,76717,56119,57121,03923,35724,42125,88527,72529,79731,037
12033211464769638093950911,46713,38114,77917,56719,57721,04123,39924,43325,88927,73129,80731,073
12093219465969658109951311,46913,39114,78117,67119,58321,04723,40524,45525,89527,73729,80931,079
12153235477370138121951911,47513,39314,81717,67519,58721,05123,41124,46725,90127,74329,81531,085
12853237478370258135952111,48113,39914,82317,67719,59321,15923,41324,46925,90727,90529,81931,091
12893247478570878141953111,48713,40314,82917,68319,61121,17123,41724,48525,90927,91529,82531,093
12953249479170998147953311,64913,44314,83517,68519,62321,28723,46324,49725,91327,92929,83131,097
12973255479571018149954111,65913,44914,83717,70119,62721,29323,47524,51725,92727,94129,83731,269
13073259490171438153954511,67313,46714,84117,70519,62921,29923,47724,52925,93127,94529,84931,281
13093269491371498165955111,68513,47915,01317,71119,63521,30123,52524,60925,93327,95129,85531,287
14153273503171558177955311,68913,48315,02517,71319,64121,30523,53724,61525,93927,95329,85931,335
14193279503771578227956311,69513,48515,03117,72319,64721,41323,55724,62125,94127,96329,86131,347
14213281504371618233956511,69713,49115,07917,72519,65521,42523,56124,63325,95727,96529,87131,527
14273287504571698251960311,70713,49715,09117,79719,65921,50523,56724,63925,96127,97329,87331,539
14293303504971758295960511,70913,50315,27117,80119,66121,51523,56924,67725,96727,97729,87931,541
14453307512371818299961511,71713,50515,28317,80719,66721,52323,57524,68125,96927,98329,88331,589
14493309512571938301962711,72113,51515,28517,80919,67321,53923,59124,68725,97927,98529,89131,601
14553315513571998307962911,72713,52315,33317,81919,67921,54123,59524,68925,98127,99529,89331,745
14573321513772038313963311,72913,53915,34517,82119,71521,55123,59724,69525,98527,99729,90331,751
14673327514372058319963911,73913,54115,48917,93319,72121,55323,60324,73925,99528,16729,90531,757
14693329514772158353964511,74113,55115,49517,94519,72921,55923,60924,74526,00928,17329,91131,769
15513339524972178359965111,91113,55315,50117,95119,74521,56323,61524,76326,02128,17929,91531,775
15633353525972238365965311,91713,55915,51317,96719,75121,63523,61724,80726,02528,18529,95331,779
16773365526772278377965711,92313,56315,51917,97919,75721,63723,62724,81126,03128,19129,96331,781
16893369528372358383967111,92913,57115,52318,06319,76321,64723,63524,81326,03328,20729,97731,791
16953375528572378421967511,93513,57315,52518,07519,76521,64923,65124,81926,04328,21929,98931,793
17113377529572478425967711,95113,58315,53518,19119,76921,65523,65324,82526,04528,23929,99331,799
17233387529772498431968311,96313,59515,53718,20319,78321,65923,66324,83126,05328,25129,99931,803
18053389530372558433968511,98313,59715,54318,20519,78721,76323,66524,86726,05728,42130,00131,811
18173397530772598439970111,99513,60115,54718,22119,78921,76923,67124,86926,06328,43130,01131,813
19353401537773018481970512,16513,60715,55518,23319,79521,77723,67524,87926,06528,43330,01331,823
19473407538373058491971112,17513,61315,55718,31719,79721,79323,68124,89126,07528,44330,01931,825
19493409538973118505971312,17713,61915,56718,32919,81321,79923,68724,89326,07728,44530,02531,831
19653419539573138549972312,18713,62115,56918,46519,81721,80523,69324,93526,11728,46130,03331,835
19773421539773198553972512,18913,62515,57518,47519,82321,81123,70524,93926,12928,47330,04932,003
20833459540173358559973512,20513,63315,57918,48319,82521,81323,71124,94126,13528,49330,05532,005
20893465550773398561974112,21713,63915,74718,53319,83521,81723,71524,94726,15128,50530,06132,015
21073473551373418571974712,23713,64515,74918,53719,83721,88923,71724,94926,16328,70730,06732,027
21513489552173478573975312,24913,65115,75918,54319,84121,89523,72724,99326,18928,71330,06932,029
21553495553773538611975912,32113,65315,77118,54519,85121,90123,72925,00326,20128,73130,07332,033
21573501554373598613977512,32713,65715,77318,55119,86521,90723,73525,01726,20728,76930,08332,039
21633507554973618623978712,33313,69715,77718,59519,87721,90923,73925,06126,22328,77930,08532,045
21693509555573718635980712,34513,70715,78318,60119,88121,91323,74725,06526,23528,78730,09532,051
21753513555773798637981912,35113,72115,78918,61919,88722,02123,74925,07126,24728,83330,10732,053
22093527556173958679986112,38713,73315,79518,66319,88922,03123,75925,07326,25328,83930,10932,057
22193531563973978683987312,38913,73715,79718,66719,89922,03323,76125,08326,25928,84530,11332,065
22273533565174078685987912,39913,74315,80118,66919,90122,03923,76725,08526,26528,85730,11932,071
22773539576574098691989512,40113,74515,80918,67519,90922,04323,77125,12526,27128,86330,12532,077
22813541577574158693990712,40713,75515,81518,68119,91322,05523,81525,13726,28728,89930,13132,083
22873557577774198743993312,41113,75715,82118,68719,91922,06723,81925,14326,29928,90130,13332,085
22893561578374278749994512,45113,76315,82718,72319,92122,15123,82125,19726,31928,91130,13732,089
22953567578774298755995112,45713,76915,82918,72919,93122,16323,82725,20926,33128,91330,14532,261
23373569579974398761996712,47513,77715,83318,73719,93322,27923,82925,21526,37528,91930,15132,273
23473579581174518767997912,51313,79316,00518,79119,97322,28523,84525,25526,38728,92330,15732,279
23613581589374538815998912,52313,79916,01718,79519,98322,29123,84925,26126,38928,96130,16332,295
24053591590574578827999912,53113,80516,02318,79719,98522,29323,85525,26726,40528,97130,16532,307
2409359760237463886910,00112,57913,81116,03918,80319,99122,29723,85725,27326,41728,98530,16932,327
2415360360297469888110,01112,58113,81316,05118,80519,99522,30923,86725,27926,44729,02730,21532,339
2417360960357475888710,01312,59113,81716,07118,84920,00722,32123,86925,32726,45929,03330,22132,519
2427361560377477894110,02912,60313,82916,08318,85920,01922,40523,87525,33926,46129,04130,22732,531
2429363160417481895310,04112,60513,84116,26318,87320,04522,41723,88125,38326,47729,09130,23332,533
2467364360537489895910,06112,64113,84716,27518,91720,05722,56523,88925,39526,48929,09330,23932,549
2473366360657495899710,07312,64713,86316,27718,92120,06322,56923,90525,39726,50129,10330,25532,561
2481367561777501900710,11912,65313,87516,29318,92720,07922,57523,91125,45526,51129,11530,26732,581
2535371761837507900910,13112,65913,89516,30518,92920,09122,57723,91725,46726,51329,11730,27732,593
2539372761897509901910,13312,66113,90716,32518,93920,10322,58323,92325,46926,52329,15330,287 
2541372962017513902110,14912,66513,95916,33718,94120,10922,62523,92525,50926,52529,15930,289 
2547373562077559906910,16112,70513,96516,42118,98120,11522,63523,92925,51926,54129,16530,295 
2549373962437563908110,19112,71513,97116,42518,99120,12122,64323,93925,52126,55329,17130,299 

Appendix C

As an application of the methodology presented in this paper, we can generate sequences with large periods, T = 2 μ , by tuning the memory parameter μ . We have proven that, once μ is chosen, all de Bruijn rules share the same divisor: ϕ ( μ ) = 2 2 μ 1 1 , and the remainders are Evil Odd Numbers. Therefore, to obtain a candidate to de Bruijn rule, take a very large Evil Odd Number and multiply it by ϕ ( μ ) . Check the resulting rule and, if valid, apply the rule to any initial binary sequence of length μ to obtain the de Bruijn sequence.
Due to computational limitations, we can only offer an example for μ = 8 , which provides a sequence of period of T = 256 . For this case,
ϕ ( 8 ) = 2 2 7 1 = 340282366920938463463374607431768211455
and take the Evil Odd Number 155640396308704138405661716133499575.
Multiply both to obtain the decimal representation of the de Bruijn rule:
R 8 = 52961682444438738040038706846647584952275525588128484521019054507752631625
The binary representation of this de Bruijn rule is
0000000000011101111110011010100111111011100101001010000100111111
1001100000011011011001001111010110000001000001001101001010110110
1111111111100010000001100101011000000100011010110101111011000000
0110011111100100100110110000101001111110111110110010110101001001
Applying this rule to the initial configuration 00000000 yields the following de Bruijn sequence:
0000000010001111101100111000111011011100100010000110000001110011
0001011010101011011000110011011010011010000010101110100010100111
1000100111010111100111111010010111000001101111010100100110010100
0110101100001111011101111111100001011111001011001001010100001001
This sequence of period T = 256 repeats infinitely under the application of the above de Bruijn rule.

References

  1. Wolfram, S. Statistical mechanics of cellular automata. Rev. Mod. Phys. 1983, 55, 601–644. [Google Scholar] [CrossRef]
  2. Wolfram, S. Computation Theory of Cellular Automata. Commun. Math. Phys. 1984, 96, 15–57. [Google Scholar] [CrossRef]
  3. Li, W. Phenomenology of Noniocal Cellular Automata. J. Stat. Phys. 1992, 68, 829–882. [Google Scholar] [CrossRef]
  4. Alonso-Sanz, R. Discrete Systems with Memory; World Scientific Series on Nonlinear Science Series A; World Scientific Publishing: Singapore, 2011; Volume 75. [Google Scholar]
  5. Jin, W.; Chen, F. Symbolic Dynamics of Cellular Automata. In Advances in Cellular Automata; Springer: Berlin/Heidelberg, Germany, 2025; pp. 375–397. [Google Scholar]
  6. Etzion, T. Sequences and the de Bruijn Graph: Properties, Constructions, and Applications; Elsevier: Amsterdam, The Netherlands, 2024. [Google Scholar]
  7. OEIS Foundation Inc. A000215 in the On-Line Encyclopaedia of Integer Sequences. Available online: https://oeis.org/A000215 (accessed on 3 August 2025).
  8. Fredricksen, H. A Survey of Full Length Nonlinear Shift Register Cycle Algorithms. SIAM Rev. 1982, 24, 195–221. [Google Scholar] [CrossRef]
  9. Golomb, W. Shift Register Sequences; Holden-Day: San Francisco, CA, USA, 1967; pp. 118–122. [Google Scholar]
  10. Zhao, X.-X.; Qi, W.-F.; Wang, Z.-X.; Zheng, Q.-X.; Tang, D. The decomposition of cascade connections of NFSRs: Old and New results. IEEE Trans. Inf. Theory 2025. [CrossRef]
  11. Gao, Z.; Feng, J. Status of Nonlinear Feedback Shift Register Based on Semi-Tensor Product. Mathematics 2022, 10, 3538. [Google Scholar] [CrossRef]
  12. De Bruijn, G. A combinatorial problem. Nederl. Akad. Wetensch. Proc. 1946, 49, 758–764. [Google Scholar]
  13. Ralston, A. De Bruijn Sequences: A Model Example of the Interaction of Discrete Mathematics and Computer Science. Math. Mag. 1982, 55, 131–143. [Google Scholar] [PubMed]
  14. Huang, S.; Zhang, H.; Bao, E. A Comprehensive Review of the de Bruijn Graph and Its Interdisciplinary Applications in Computing. Eng. Sci. 2024, 28, 1061. [Google Scholar] [CrossRef]
  15. Miroschnyk, M.; Korytchinko, T.; Demihev, O.; Krylova, V.; Karaman, D.; Filippenko, I. Practical methods for de Bruijn sequences generation using non-linear feedback shift registers. In Proceedings of the 2018 14th International Conference on Advanced Trends in Radioelecrtronics, Telecommunications and Computer Engineering (TCSET), Lviv-Slavske, Ukraine, 20–24 February 2018; pp. 1157–1161. [Google Scholar] [CrossRef]
  16. Knuth, D.E. The Art of Computer Programming, Volume 4A: Combinatorial Algorithms, Part 1; Pearson Education: Upper Saddle River, NJ, USA, 2011. [Google Scholar]
  17. OEIS Foundation Inc. A016031 in the On-Line Encyclopaedia of Integer Sequences. Available online: https://oeis.org/A016031 (accessed on 3 August 2025).
  18. Hall, M. Combinatorial Theory; Blaisdell: Waltham, MA, USA, 1967. [Google Scholar]
  19. De Bruijn Sequence and Universal Cycle Constructions. 2024. Available online: http://debruijnsequence.org (accessed on 3 August 2025).
  20. OEIS Foundation Inc. A129771 in the On-Line Encyclopaedia of Integer Sequences. Available online: https://oeis.org/A129771 (accessed on 3 August 2025).
  21. Bishop, C.M. Neural Networks for Pattern Recognition; Oxford University Press: Oxford, UK, 1995. [Google Scholar]
  22. R Core Team. R: A Language and Environment for Statistical Computing; R Foundation for Statistical Computing: Vienna, Austria, 2024; Available online: https://www.R-project.org/ (accessed on 11 August 2025).
  23. Kalinowski, T.; Falbel, D.; Allaire, J.J.; Chollet, F.; Tang, Y.; Bijl, W.V.D.; Studer, M.; Keydana, S. Keras: R Interface to ’Keras’. R Package Version 2.16.0. 2024. Available online: https://CRAN.R-project.org/package=keras (accessed on 11 August 2025).
Figure 1. Two generating rules with memory μ = 3 . (A) Rule 150, whose binary representation is 10010110. This corresponds to the following assignments for each 3-tuple (ordered from 111 to 000): 111 1 , 110 0 , 101 0 , 100 1 , 011 0 , 010 1 , 001 1 , 000 0 . The application of this rule to four different initial triplets is shown on the right of panel (A). As observed, the resulting sequences are periodic with periods 1, 4, 1, and 2 (from top to bottom). The dynamics of this rule can be visualized as a directed graph, shown at the bottom. Each node represents a possible 3-tuple; a directed edge from node x to node y exists if applying the rule to x yields the last digit of y. This graph is not connected and does not contain a Hamiltonian path. (B) Rule 45, with binary representation 00101101, corresponds to the truth table shown on the left of panel B. In contrast to Rule 150, applying Rule 45 to any of the 2 3 = 8 initial triplets yields the same cyclic sequence of maximum period T max = 8 , namely, the de Bruijn sequence s 6 = 00010111 . This rule is thus a de Bruijn rule. The associated graph, built as described above, is a de Bruijn graph because it contains a Hamiltonian path through all 2 3 nodes.
Figure 1. Two generating rules with memory μ = 3 . (A) Rule 150, whose binary representation is 10010110. This corresponds to the following assignments for each 3-tuple (ordered from 111 to 000): 111 1 , 110 0 , 101 0 , 100 1 , 011 0 , 010 1 , 001 1 , 000 0 . The application of this rule to four different initial triplets is shown on the right of panel (A). As observed, the resulting sequences are periodic with periods 1, 4, 1, and 2 (from top to bottom). The dynamics of this rule can be visualized as a directed graph, shown at the bottom. Each node represents a possible 3-tuple; a directed edge from node x to node y exists if applying the rule to x yields the last digit of y. This graph is not connected and does not contain a Hamiltonian path. (B) Rule 45, with binary representation 00101101, corresponds to the truth table shown on the left of panel B. In contrast to Rule 150, applying Rule 45 to any of the 2 3 = 8 initial triplets yields the same cyclic sequence of maximum period T max = 8 , namely, the de Bruijn sequence s 6 = 00010111 . This rule is thus a de Bruijn rule. The associated graph, built as described above, is a de Bruijn graph because it contains a Hamiltonian path through all 2 3 nodes.
Mathematics 13 02598 g001
Figure 2. Bar chart of the proportion of rules as a function of the maximum period of the sequences that each of them generates over the initial sequences for a memory μ = 4 . Note that T = 16 has the lower occurrence; as a matter of fact, there are 2 2 3 4 de Bruijn rules, which result in a relative frequency of 16 / 65 , 536 0.0002 .
Figure 2. Bar chart of the proportion of rules as a function of the maximum period of the sequences that each of them generates over the initial sequences for a memory μ = 4 . Note that T = 16 has the lower occurrence; as a matter of fact, there are 2 2 3 4 de Bruijn rules, which result in a relative frequency of 16 / 65 , 536 0.0002 .
Mathematics 13 02598 g002
Table 1. Number of rules that generates sequences with each of the possible periods (columns) that can appear, from 1 to 16, for μ = 4 , applied to the 2 4 initial sequences (rows). Notice that the total number of rules for this μ -value is 2 2 4 = 65,536, which equal the sum of each row. As it can be observed, the distributions of periods are symmetric to middle rows. Note that the maximum period occurs at the last column ( T = 16 ) for 16 rules and for every initial condition.
Table 1. Number of rules that generates sequences with each of the possible periods (columns) that can appear, from 1 to 16, for μ = 4 , applied to the 2 4 initial sequences (rows). Notice that the total number of rules for this μ -value is 2 2 4 = 65,536, which equal the sum of each row. As it can be observed, the distributions of periods are symmetric to middle rows. Note that the maximum period occurs at the last column ( T = 16 ) for 16 rules and for every initial condition.
Initial Sequence12345678910111213141516
000036,0963304494447345836375824721846112075833214480484816
000112,91266089888946896246492392029241728106844020896806416
001011,800897611,78084578976569735522803163499541220094806416
001115,36853209490925292966397370229811756106744420796806416
010014,568552411,588886091905851357028341672101141420094806416
010110,52016,384845864948542575536202572143891940619280766416
011012,032642812,398912894386043348629751714101942219994806416
011121,37649567416812582425637358026411648102542620896806416
100021,37649567416812582425637358026411648102542620896806416
100112,032642812,398912894386043348629751714101942219994806416
101010,52016,384845864948542575536202572143891940619280766416
101114,568552411,588886091905851357028341672101141420094806416
110015,36853209490925292966397370229811756106744420796806416
110111,800897611,78084578976569735522803163499541220094806416
111012,91266089888946896246492392029241728106844020896806416
111136,0963304494447345836375824721846112075833214480484816
Table 2. Correspondence betweeen de Bruijn rules and de Bruijn sequences for μ = 1 , 2 , 3 and 4. The table also shows the Evil Odd Number that divides each de Bruijn rule, leaving the remainder ϕ ( μ ) . The Evil Odd Numbers that correspond to de Bruijn rules for μ = 5 are presented in Appendix B.
Table 2. Correspondence betweeen de Bruijn rules and de Bruijn sequences for μ = 1 , 2 , 3 and 4. The table also shows the Evil Odd Number that divides each de Bruijn rule, leaving the remainder ϕ ( μ ) . The Evil Odd Numbers that correspond to de Bruijn rules for μ = 5 are presented in Appendix B.
μ Evil Odd Number ϕ ( μ ) Rule in DecimalRule in Binaryde Bruijn Sequence
1--10101
2-3300110011
3315450010110100010111
3515750100101100011101
4325576500000010111111010000101101001111
49255229500001000111101110000110100101111
415255382500001110111100010000100110101111
417255433500010000111011110000111100101101
427255688500011010111001010000101111001101
429255739500011100111000110000110101111001
44325510,96500101010110101010000101001101111
45725514,53500111000110001110000110111100101
46525516,57501000000101111110000111101001011
47125518,10501000110101110010000100111101011
47525519,12501001010101101010000101111010011
48325521,16501010010101011010000101100111101
48525521,67501010100101010110000111101011001
48925522,69501011000101001110000110010111101
49925525,24501100010100111010000101001111011
411325528,81501110000100011110000111101100101
Table 3. Table resulting from the application of the properties described in Section 4. The second column, C ( μ ) , indicates the total number of rules for each value of μ . The third column shows the number of feasible rules remaining after applying the constraints detailed in Section 4. The fourth column lists the number of de Bruijn rules. The remaining columns present ratios between these subsets. Particularly noteworthy is the fifth column, which displays the ratio between the feasible subset and the total number of rules. As μ increases, the reduction in the search space for de Bruijn rules becomes dramatic — for example, for μ = 9 , the feasible subset constitutes only about 10 79 of the full rule set.
Table 3. Table resulting from the application of the properties described in Section 4. The second column, C ( μ ) , indicates the total number of rules for each value of μ . The third column shows the number of feasible rules remaining after applying the constraints detailed in Section 4. The fourth column lists the number of de Bruijn rules. The remaining columns present ratios between these subsets. Particularly noteworthy is the fifth column, which displays the ratio between the feasible subset and the total number of rules. As μ increases, the reduction in the search space for de Bruijn rules becomes dramatic — for example, for μ = 9 , the feasible subset constitutes only about 10 79 of the full rule set.
μ C ( μ ) # Feasible# de BruijnFeasible/Totalde Bruijn/Totalde Bruijn/Feasible
216 1 0.0625
3256220.00781250.00781251
465,53624160.0003662110.000244140.66666667
54,294,967,296614420481.4305 × 10 6 4.7683 × 10 7 0.33333333
61.84467 × 1019402,653,18467,108,8642.1827 × 10 11 3.6379 × 10 12 0.16666667
73.40282 × 10381.7293 × 10181.4411 × 10175.0820 × 10 21 4.2351 × 10 22 0.08333333
81.15792 × 10773.1901 × 10371.3292 × 10362.7550 × 10 40 1.1479 × 10 41 0.04166667
91.3408 × 101541.0855 × 10762.2615 × 10748.0964 × 10 79 1.6867 × 10 80 0.02083333
Table 4. Evaluation metrics for the neural network models applied to classify the de Bruijn rules for memories with μ = 5 and μ = 6 . Total refers to the sumTP + FP + TN + FN and corresponds to one fifth of the whole dataset. The positive class considered 1 → de Bruijn.
Table 4. Evaluation metrics for the neural network models applied to classify the de Bruijn rules for memories with μ = 5 and μ = 6 . Total refers to the sumTP + FP + TN + FN and corresponds to one fifth of the whole dataset. The positive class considered 1 → de Bruijn.
Metric, Definition μ = 5 μ = 6
True Positives (TP)397198,563
False Positives (FP)319,839
True Negatives (TN)820180,668
False Negatives (FN)9930
Accuracy, (TP + TN)/Total0.99020.9481
Sensitivity (Recall), TP/(TP + FN)0.97780.9953
Specificity, TN/(TN + FP)0.99640.9011
Precision (PPV), TP/(TP + FP)0.99250.9092
Negative Predictive Value (NPV), TN/(TN + FN)0.98910.9949
Balanced Accuracy, (Sens. + Spec.)/20.98710.9482
Detection Rate, TP/Total0.32300.4964
Detection Prevalence, (TP + FP) / Total0.32550.5460
True Prevalence, (TP + FN) / Total0.33030.4987
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Muñoz, F.J.; Nuño, J.C. Rule-Based Generation of de Bruijn Sequences: Memory and Learning. Mathematics 2025, 13, 2598. https://doi.org/10.3390/math13162598

AMA Style

Muñoz FJ, Nuño JC. Rule-Based Generation of de Bruijn Sequences: Memory and Learning. Mathematics. 2025; 13(16):2598. https://doi.org/10.3390/math13162598

Chicago/Turabian Style

Muñoz, Francisco J., and Juan Carlos Nuño. 2025. "Rule-Based Generation of de Bruijn Sequences: Memory and Learning" Mathematics 13, no. 16: 2598. https://doi.org/10.3390/math13162598

APA Style

Muñoz, F. J., & Nuño, J. C. (2025). Rule-Based Generation of de Bruijn Sequences: Memory and Learning. Mathematics, 13(16), 2598. https://doi.org/10.3390/math13162598

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Article metric data becomes available approximately 24 hours after publication online.
Back to TopTop