Probability of choosing a subset of elements where each element has a different probability I am trying to write a C++ program to do this but nobody on Stackoverflow can seem to help me so I thought I'd try to do it myself with some help from you guys. 
My post on Stackoverflow can be found here:
https://stackoverflow.com/questions/22727196/calculating-a-conditional-probability-that-is-similar-to-a-binomial-sum
My exact question would be, if I had 6 people where the probabilities of each person saying yes is given respectively by $(\frac{1}{2},\frac{1}{3},\frac{1}{4},\frac{1}{5},\frac{1}{6},\frac{1}{7})$ respectively, what is the closed form summation form of the probability that 2 of them say yes?
I can calculate the probability of this directly by hand but I am having difficulty finding a closed form expression.

Let $p_i$ be the probability of person $i$ saying yes, and let $q_k$ be the probability of exactly $k$ out of $n$ persons saying yes. Then,
$$
q_k = \left[\prod_{i=1}^n(1-p_i + p_ix)\right]_k,
$$
where $[f(x)]_k$ is the coefficient of $x^k$ in the series expansion of  $f(x)$.
In your question, $p_i = \frac{1}{i}$, and $k=2$. So,
$$
q_2 = \left[\prod_{i=2}^{n+1}\left(1-\frac{1}{i} + \frac{x}{i}\right)\right]_2.
$$
One can find $q_2$ by taking the second derivate of the product with respect to $x$ and setting $x=0$, which gives
\begin{align*}
q_2 &= \sum_j\frac{1}{j}\sum_{i\neq j}\frac{1}{i}\prod_{l\neq i,j}\left(1-\frac{1}{l}\right)
&=\frac{1}{n+1}\sum_{j=2}^{n+1}\sum_{i=2,i\neq j}^{n+1}\frac{1}{(i-1)(j-1)}.
\end{align*}
