Denote by F (N) the number of rows of length N, not containing two units in a row. Denote by F0 (N) the number of rows of length N, which do not contain two units in a row and end with 0. Denote F1 (N) the number of rows of length N, which do not contain two units in a row and end with 1.
We derive the recurrence formulas for F0 and F1.
F1 (N) = F0 (N-1). Since two units cannot go in a row, the number of lines ending in 1 is equal to the number of lines 1 shorter, ending in 0.
F0 (N) = F0 (N-1) + F1 (N-1). Zero can be added to any valid line, without violating the conditions. This means that the number of lines ending in 0 is equal to the number of lines in 1 shorter.
F0 (N) = F0 (N-1) + F1 (N-1) = F0 (N-1) + F0 (N-2). So, F0 is a Fibonacci series with a certain shift. F1 (N) = F0 (N-1), then F1 also consists of Fibonacci numbers, with a âlagâ of 1 relative to F0.
F (N) = F0 (N) + F1 (N). The F (N) term is obtained when a Fibonacci number F0 is added to a Fibonacci number F1, which is the previous number for it. And the sum of the Fibonacci number with the previous Fibonacci number is also the Fibonacci number (according to the formula of Fibonacci numbers). So, we have proven that the
number of rows that do not include two units in a row will be the Fibonacci number . It remains to determine the value of F (N) for the first two N. F (1) = 2 (two suitable sequences: "0" and "1"), F (2) = 3 (three suitable sequences: "00", "01" , "ten").
