# [SOLVED] unique combination formula

• Jun 15th 2005, 02:33 PM
barry_o
[SOLVED] unique combination formula
Can anyone help!!!!.

I am trying to work out a formula for calculating unique combinations of items in a store e.g. 4 bottles of wine - select any 3 for £10.

This throws up a problem as for example if we name them 1,2,3 , the unique combinations are :

111 , 112 , 113 , 114 , 221 , 222 , 223 , 224 , 331 , 332 , 333 , 334

441 , 442 , 443 , 444 , 123 , 234 , 124 , 134

I need to ignore duplicates as 112 = 121 = 211 , 234 = 324 = 432 etc.

I would like to increase the number of items from 4 to say 10 and work out all combinations with a formula rather then by hand.

This is probably a breeze for you maths folks but it has had me scratching my head for a while !!!!

Thanks,

Barry.
• Jul 12th 2005, 06:42 AM
I believe you are trying to use Permutations and Combinations!!

Say you have 4 distinct wine bottles(A,B,C and D) and you want to select 3
AAA isnt an option since there are only 4 bottles
However ABC is the same as BAC,CBA .......

So from 4 bottles number of ways of selecting 3 is given by 4C3 and solved as

(4x3x2)/(1x2x3) which is basically 4 ways.

There's a whole lot more!!
• Feb 5th 2009, 06:41 PM
dbrereton6
the answer you are looking for is not a simple combination, but a form of triangular number. after thinking about the problem myself for a time, i came up with this formula; i think that it is correct.
http://latex.codecogs.com/gif.latex?...ht%29%28n-k%29
[IMG]file:///C:/DOCUME%7E1/IBM/LOCALS%7E1/Temp/moz-screenshot-2.jpg[/IMG][IMG]file:///C:/DOCUME%7E1/IBM/LOCALS%7E1/Temp/moz-screenshot-3.jpg[/IMG]
• Mar 24th 2009, 03:35 PM
thvy
Look like the combination of r from n with repeated, and the formula should be like this ((n+r-1) over r)
which is same as (n+r-1)!/r!(n-r)!
where n is number of thing to choose from, choose r from n.
In your case, n is 4 and r is 3
So the number of combination will be:
((4+3-1) over 3) = (4+3-1)! / (3!)(4-1)!= 6!/(3!)(3!)
= (6x5x4x3x2x1)/(3x2x1)(3x2x1)=20.