Survey

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Transcript

We put numbers from {1, 2, …, S} in 2 x n table like that 1 2 n+1 3 … n-1 n 2n-1 2n Our problem is equivalent to count how many of ways we can select some (maybe none) numbers from table, such that 1) two neigbors numbers can not be selected simultaneously 2) n and n+1 can not be selected simultaneously. Let S(n) be the answer of our problem. Let denote A(n), B(n), C(n) be the number of ways we can select (maybe none) numbers from following tables, respectively 1 2 n+1 3 … n-1 n 2n-1 2n 1 2 3 … n-1 n 2n-1 2n 1 2 3 n+2 … n-1 n 2n-1 2n such that two neigbors numbers can not be selected simultaneously. Then it is easy to see that S(n) = A(n) – C(n-2). And we have following relations: A(n) = A(n-1) + 2B(n-1) (we divide the ways of A(n) into theree cases 1) without 1 and n+1 3) with n+1) B(n) = A(n-1) + B(n-1) (with the same arguments) C(n) = B(n-1) + B(n-2) + C(n-2) (without 1, with 1 and without n+2, with 1 and with n+2) (1) 2) with 1 (2) (3) From these relations we can compute A(n), B(n), C(n) and S(n). For example, it is easy to deduce that A(n) = 2A(n-1) + A(n-2), A(0) = 1 , A(1) = 3, A(2) = 7. (4) and then A(n) (1 2 ) n 1 (1 2 ) n 1 , 2 C(n) is computed from the relation C(n) = C(n-2) + A(n-1) (B(n-1) + B(n-2) = A(n-2) + B(n-2) + B(n-2) = A(n-1)) (5) A(n) A(n 2) 2 A(n) A(n 2) C ( n) C (n 2) 2 2 C (n) C (n 2) We notice that C(1) = 1, C(2) = 4, C(3) = 8. From last relation and the fact C(1) – A(1)/2 = -1/2, C(2) – A(2)/2 = 1/2, C(3) – A(3)/2 = -1/2 we conclude that C(n) – A(n)/2 = (-1)n/2 So C ( n) A(n) (1) n 2 And finally S (n) A(n) C (n 2) (3 2 )(1 2 ) n (3 2 )(1 2 ) n 2(1) n . 4 Notes: The relation S(n) = S(n-1) + 3S(n-2) + S(n-3) follows from (1), (2), (3).