1
$\begingroup$

Possible Duplicate:
Counting subsets containing three consecutive elements (previously Summation over large values of nCr)

Suppose we have a set like (1,2,3) then there is only one way to choose 3 consecutive number...its (1,2,3)....for a sets of 4 (1,2,3,4) we have 3 ways ( (1,2,3), (2,3,4), (1,2,3,4)) for five its 8 ,for 6 its 20, for 7 its 47 and so on....So for a given N, I can get the answer by applying brute force, and calculating all such subset having 3 or more consecutive number. Here I am just trying to find out a pattern, a technique to get the number of all such subset for a given N. The problem is further generalized to .....discover m consecutive number within a set of size N.

  • 0
    @Marc Ah, I see. That is not how I had interpreted the question. When I read "choose 3 and ore consecutive numbers," I interpret this as the number of ways of choosing 3 consecutive, or 4 consecutive, or 5, etc. But in the example he posted, I see this is not the case.2012-09-09

1 Answers 1

0

HINT:

The number of selections of $k$ consecutive things out of $n$ things in a row is given by $n-k+1$.