Skip to content

GATE CS 2014 Set 1 Q49 — Combinatorics: Counting, Recurrence Relations, Generating Functions

Explain with AI
A pennant is a sequence of numbers, each number being 11 or 22. An n−n-pennant is a sequence of numbers with sum equal to nn. For example, (1,1,2)(1,1,2) is a 4−4-pennant. The set of all possible 1−1-pennants is (1){(1)}, the set of all possible 2−2-pennants is (2),(1,1){(2), (1,1)} and the set of all 3−3-pennants is (2,1),(1,1,1),(1,2){(2,1), (1,1,1), (1,2)}. Note that the pennant (1,2)(1,2) is not the same as the pennant (2,1)(2,1). The number of 10−10-pennants is________
View worked solution

Answer: 89

Let P(n)P(n) denote the number of nn-pennants (sequences of 11s and 22s that sum to nn).

An nn-pennant can be formed in one of two mutually exclusive ways:

  1. By appending 11 to an (n−1)(n-1)-pennant. There are P(n−1)P(n-1) such pennants.
  2. By appending 22 to an (n−2)(n-2)-pennant. There are P(n−2)P(n-2) such pennants.

This gives us the recurrence relation:

P(n)=P(n−1)+P(n−2)for n≥3P(n) = P(n-1) + P(n-2) \quad \text{for } n \ge 3

We are given the base cases:

  • For n=1n = 1: the only pennant is (1)(1), so P(1)=1P(1) = 1.
  • For n=2n = 2: the pennants are (2)(2) and (1,1)(1,1), so P(2)=2P(2) = 2.

Using the recurrence relation, we can compute the values sequentially:

  • P(3)=P(2)+P(1)=2+1=3P(3) = P(2) + P(1) = 2 + 1 = 3
  • P(4)=P(3)+P(2)=3+2=5P(4) = P(3) + P(2) = 3 + 2 = 5
  • P(5)=P(4)+P(3)=5+3=8P(5) = P(4) + P(3) = 5 + 3 = 8
  • P(6)=P(5)+P(4)=8+5=13P(6) = P(5) + P(4) = 8 + 5 = 13
  • P(7)=P(6)+P(5)=13+8=21P(7) = P(6) + P(5) = 13 + 8 = 21
  • P(8)=P(7)+P(6)=21+13=34P(8) = P(7) + P(6) = 21 + 13 = 34
  • P(9)=P(8)+P(7)=34+21=55P(9) = P(8) + P(7) = 34 + 21 = 55
  • P(10)=P(9)+P(8)=55+34=89P(10) = P(9) + P(8) = 55 + 34 = 89

Thus, the number of 1010-pennants is 89.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Combinatorics: Counting, Recurrence Relations, Generating Functions questions