*Originally posted by clandarkfire*

**How many seven digit numbers can be built using two 2s and five 5s?
**

A friend asked me this last week, and I cant figure out how to do it. There must be a way to do it without trying every possibility, but I cant figure it out.

there are combinatorical numbers called the "choose" numbers that describe the answer to the generic question you just asked... they also are the elements of pascals triangle, and there is a discrete formula for computing "n choose k," or in other words, counting the number of ways you can order "n" things while "choosing k" of the elements.

in this case you want to order 7 things while choosing two of them as 2 and letting the rest be 5's (note: alternatively, you could think of this as ordering 7 things while choosing 5 of them as 5's and leaving the rest 2's... and you will see by the computation that these processes are identical)

now "n choose k," sometimes seen as n

**C**k (or as an n-superscript and a k-subscript directly above and below each other, in between parentheses), is computed as follows:

n

**C**k = n!/(k! * [n-k]!) . i won't derive it for you here, but a little wikipedia and/or searching for combinatorics literature is quite nice!

so in your case: 7

**C**2 = 7!/(5!*2!) = 7*6/2*1 = 21 different ways. computing 7

**C**5 and verifying its equality, and considering why

**nCk** and

**nC(n-k)** are equal is left to the reader.

hope this helps! cheers!