A maximum-length sequence (MLS) is a type of pseudorandom binary sequence. They are bit sequences generated using maximal linear-feedback shift registers and are so called because they are periodic and reproduce every binary sequence (except the zero vector) that can be represented by the shift registers (i.e., for length-m registers they produce a sequence of length 2m − 1). An MLS is also sometimes called an n-sequence or an m-sequence. MLSs are spectrally flat, with the exception of a near-zero DC term. These sequences may be represented as coefficients of primitive polynomials in a polynomial ring over Z/2Z. Practical applications for MLS include measuring impulse responses (e.g., of room reverberation or arrival times from towed sources in the ocean). They are also used as a basis for deriving pseudo-random sequences in digital communication systems that employ direct-sequence spread spectrum and frequency-hopping spread spectrum transmission systems, and in the efficient design of some fMRI experiments.
Generation
MLS are generated using maximal linear-feedback shift registers. An MLS-generating system with a shift register of length 4 is shown in Fig. 1. It can be expressed using the following recursive relation:
{ a 3 [ n + 1 ] = a 0 [ n ] + a 1 [ n ] a 2 [ n + 1 ] = a 3 [ n ] a 1 [ n + 1 ] = a 2 [ n ] a 0 [ n + 1 ] = a 1 [ n ] {\displaystyle {\begin{cases}a_{3}[n+1]=a_{0}[n]+a_{1}[n]\\a_{2}[n+1]=a_{3}[n]\\a_{1}[n+1]=a_{2}[n]\\a_{0}[n+1]=a_{1}[n]\end{cases}}}
where n is the time index and + {\displaystyle +} represents modulo-2 addition. For bit values 0 = FALSE or 1 = TRUE, this is equivalent to the XOR operation. As MLS are periodic and shift registers cycle through every possible binary value (with the exception of the zero vector), registers can be initialized to any state, with the exception of the zero vector.
Polynomial interpretation A polynomial over GF(2) can be associated with the linear-feedback shift register. It has degree of the length of the shift register, and has coefficients that are either 0 or 1, corresponding to the taps of the register that feed the xor gate. For example, the polynomial corresponding to Figure 1 is x 4 + x + 1 {\displaystyle x^{4}+x+1} . A necessary and sufficient condition for the sequence generated by a LFSR to be maximal length is that its corresponding polynomial be primitive.
Implementation MLS are inexpensive to implement in hardware or software, and relatively low-order feedback shift registers can generate long sequences; a sequence generated using a shift register of length 20 is 220 − 1 samples long (1,048,575 samples).
Properties of maximum-length sequences MLS have the following properties, as formulated by Solomon Golomb.
Balance property The occurrence of 0 and 1 in the sequence should be approximately the same. More precisely, in a maximum-length sequence of length 2 n − 1 {\displaystyle 2^{n}-1} there are 2 n − 1 {\displaystyle 2^{n-1}} ones and 2 n − 1 − 1 {\displaystyle 2^{n-1}-1} zeros. The number of ones equals the number of zeros plus one, since the state containing only zeros cannot occur.
Run property A "run" is a sub-sequence of consecutive "1"s or consecutive "0"s within the MLS concerned. The number of runs is the number of such sub-sequences. Of all the "runs" (consisting of "1"s or "0"s) in the sequence :
One half of the runs are of length 1. One quarter of the runs are of length 2. One eighth of the runs are of length 3. ... etc. ...
… excerpt ends here. Continue reading the full article.

