# Combinations n things not all different

1. Apr 12, 2013

### justwild

Is there any formula which gives the combinations for n things (taken r at a time, r being less than n) which are NOT ALL different?
Say you have a total of n things and in those n things you have p things identical. Then you are required to select r things (r may be less or greater than p). Then what are possible ways of selecting r?

2. Apr 13, 2013

### CompuChip

Since nobody has answered yet, I will post my less-than-ideal answer which is more of a way that you could approach it rather than a guaranteed way of getting at the right answer.

You could first ask what the number of possible ways is, if you select $0 \le k \le r$ of the p identical ones and (r - k) of the non-identical ones. This should give you an expression involving loads of factorials that hopefully simplifies. Then sum over k = 0 to r (or k = 0 to p, if r > p).