This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Relevant wiki: Double Counting
Here, we make use of the double counting technique:
Consider a team, which has n males, n females and 1 leader. The number of combinations of n people in total showing up in an event can be counted in two different ways:
( 1 ) . Since this is equivalent to choosing n elements from n + n + 1 = 2 n + 1 elements, the number of combinations can be expressed as ( n 2 n + 1 ) .
( 2 ) . Let the n males and n females form n pairs of couples. Then among the n people who show up, some people's partners might be absent. Let the number of people whose partners are absent be i , with 0 ⩽ i ⩽ n .
First, choose the couples containing the i people whose partners are missing. Since there are a total of n couples, we can do this in ( i n ) ways. Then choose one person from each couple to show up, which can be done in 2 i ways. Therefore, there are 2 i ( i n ) number of ways to choose the i people with missing partners.
Next, choose the couples who do show up (i.e. each person's partner is not missing). Let the number of couples who do show up be k . Then, consider two situations, namely, when the leader shows up and when the leader doesn't show up. If the leader shows up, then 2 k + 1 + i = n , giving k = 2 n − i − 1 . If the leader doesn't show up, then 2 k + i = n , giving k = 2 n − i . Either way, k = ⌊ ( n − i ) / 2 ⌋ .
Since we've already selected i people with absent partners, we only have n − i potential couples to show up. The number of ways of choosing k couples from these n − i potential couples is therefore ( k n − i ) = ( ⌊ ( n − i ) / 2 ⌋ n − i ) .
Summing over 0 ⩽ i ⩽ n , we have the result
i = 0 ∑ n 2 i ( i n ) ( ⌊ 2 n − i ⌋ n − i ) = ( n 2 n + 1 ) .
Thus, M = 2 × 2 0 1 7 + 1 = 4 0 3 5 .