how many sequences of 1's and 2's sum to 14?

6 views
Skip to first unread message

Mickey

unread,
May 10, 2010, 1:15:16 AM5/10/10
to nextgen_engg
To get a feeling for the problem, let's do the counting when the sum
is small. Let f(n) be the number of sequences of 1's and 2's which sum
to n. f(1) = 1 because there is only one way that a sequence of 1's
and 2's sum to 1, namely, 1 = 1. f(2) = 2 because there are exactly
two ways a sequence of 1's and 2's can sum to 2, namely, 1 + 1 = 2 and
2 = 2. f(3) = 3 because 1 + 1 + 1 = 1 + 2 = 2 + 1 = 3.

I would suggest that you do not count... the answer is more than 500.

Regards,
Jyoti

Narendra Chennupati

unread,
May 10, 2010, 1:37:49 AM5/10/10
to nextge...@googlegroups.com
14 C 7 + 14 C 6 + 14 C5 +..........................+ 14 C 0

praneeth juturu

unread,
May 10, 2010, 4:43:13 AM5/10/10
to nextge...@googlegroups.com
f(14) needs to be found.
f(14)=No of sequences having  digit 2 repeated x times and digit 1 repeated y times.
To get a sum of 14 y needs to be an even number.
So,
14=2*x+1*2n
 =>14=2(x+n)
so x+n=7
The possible values for  x and n are
x  ----- n
1        6
2        5
3        4
4        3
5        2
6        1
7        0
 
Consider the case where x=1 and n=6 ----> has digit 2 repeated once and digit 1 repeated twelve times(n=6)
Note: The number of ways of arranging a identical and b identical things together to contain a+b things are (a+b)! / ((a!)*(b!)) 
In the considered case a=1 and b=12 ; No of ways of arranging 1 identical thing and 12 identical things are (13!)/(12!)*(1!)=13
 
In Similar Lines.....
 
x  ----- n ------- No of arrangements
1        6         13
2        5         66
3        4        165
4        3        210
5        2        126
6        1          28
7        0            1
               ------------------
     Total        609
               ----------------
 
No of Sequences of 1's and 2's sum to 14 are 609.
 
 
Regards
Praneeth

Mickey

unread,
May 10, 2010, 5:54:20 AM5/10/10
to nextgen_engg
Praneeth,
That is nice.

You considered all 2's (n=0) but missed all 1's(x=0)... the answer is
610.
The motivation for this question was to find the recurrence relation.
It is fibonacii series.
610 is the 14th Fibonacii number (or 15th according to some books
depending on how they start).

Regards,
Jyoti
> narendra....@gmail.com> wrote:
> > 14 C 7 + 14 C 6 + 14 C5 +..........................+ 14 C 0
>
Reply all
Reply to author
Forward
0 new messages