A general binary feedback shift register of length has stateand a feedback function . One update outputs the oldest bit, shifts the state, and insertsThe initial fill is . It is a linear-feedback shift register whenfor fixed .
The Berlekamp-Massey algorithm reads an intercepted sequence from left to right while maintaining the shortest connection polynomial that reproduces the prefix. At each new symbol it computes the discrepancy between the observed bit and that predicted by the current recurrence. A zero discrepancy leaves the polynomial unchanged; a nonzero discrepancy adds a suitably shifted copy of the connection polynomial saved at the previous increase in linear complexity. After at least twice the unknown register length, it recovers the shortest recurrence, after which the entire keystream can be predicted.
Applying those discrepancy updates toreturns the connection polynomialEquivalently, the sequence obeysIndeed this predicts successively . No recurrence of length one or two fits the prefix, so its linear complexity is three.
Solved by gpt-5.6-sol high.
Codex Wiki