Homepage › Solution manuals › Ivan Niven › An Introduction to the Theory of Numbers › Exercise 4.4.15* (Some combinatorics)
Exercise 4.4.15* (Some combinatorics)
Let denote the number of sequences that can be constructed where each is , or , subject to the restrictions that no consecutive terms can be , and no consecutive terms can be . Prove that is the integer nearest to .
Answers
Proof. Consider the set of sequences satisfying the restrictions that no consecutive terms can be , and no consecutive terms can be . We define
and the cardinalities of .
Since is the disjoint union of ,
Moreover, for , if we fix , then any sequence can precede , so . If we fix , only the sequences such that or are possible so that , and similarly . For , this gives the system
Note that and by (1), if , then , so
By eliminating we obtain for the shortest system
We give to and the conventional values , so that for all ,
We may write (4) in the form
We define , and , so that for every . Then
The eigenvalues of are the roots of
where
The eigenvalues are distinct, so there is a matrix such that . Therefore
so
where are constant real numbers. Then
where .
(Alternatively, we can prove (6) without linear algebra by showing with (4) that and for , and using Theorem 4.10.)
We find and with the values and . Then
so
Therefore
Moreover, , so , therefore
thus
Therefore is the integer nearest to . We can write
□
Note: We give some ways to compute with Sagemath.
def f(n): u, v = 1, 1 for i in range(1, n): u, v = u + 2 * v, u + v return u + 2 * v def f(n): a = (1/2) * (1 + sqrt(2))^(n + 1) + (1/2) * (1 - sqrt(2))^(n + 1) return int(round(a.n(), 2)) def f(n): a = (1/2) * (1 + sqrt(2))^(n + 1) return floor(a.n() + 0.5) def f(n): A = matrix([[1,2], [1,1]]) B = A^n return B[0][0] + 2 * B[1][0] [f(n) for n in range(1, 10)] [3, 7, 17, 41, 99, 239, 577, 1393, 3363]
(same results for the four solutions).
The best is the last solution, which computes only with integers, and uses fast exponentiation of matrices, so .