Skip to content

Instantly share code, notes, and snippets.

@theophani
Forked from fronx/gist:867312
Created March 13, 2011 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theophani/868008 to your computer and use it in GitHub Desktop.
Save theophani/868008 to your computer and use it in GitHub Desktop.
Q: i want to choose 4 people out of 4 couples. i want a group with at least 1 couple.
4 couples:
ab
cd
ef
gh
> > > selecting among the four couples is:
> > > (4 choose 1) = 4
> > > This part of your work was the AHA! for me to see the formal answer:
non-couples:
6:a(c,d,e,f,g,h)
6:b(c,d,e,f,g,h)
4:c(e,f,g,h)
4:d(e,f,g,h)
2:e(g,h)
2:f(g,h)
--
24
pre-selecting one couple reduces # of selectable non-couples to 12.
> > > 12 is the number of non-couples after pre-selection:
> > > (3 choose 2) * (2 choose 1) * (2 choose 1) = 12
> > > choose two of remaining couples, and from each couple, choose 1 person
couple(couple):
3:ab(cd,ef,gh)
2:cd(ef,gh)
1:ef(gh)
-
6
> > > this is the two couple scenario:
> > > (4 choose 2) = 6
for each couple:
couple(12 non-couples + remaining selectable couples)
15:ab(12 + 3)
14:cd(12 + 2)
13:ef(12 + 1)
12:gh(12)
--
54
==
> > > the possible ways to pre-select is (4 choose 1) = 4, and thus
> > > the number of ways to pre-select a couple, and then choose a non-couple is:
> > > 4 * 12 = 48
> > > And then add that to the ways to select 2 couples:
> > > 6 + 48 = 54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment