Bitcoin Forum

Economy => Services => Topic started by: elgreco on April 10, 2014, 08:51:45 PM



Title: (CLOSED) 0.01BTC for some math help :)
Post by: elgreco on April 10, 2014, 08:51:45 PM
First person with a functional answer gets 0.01BTC

Problem:

I need a one line expression to edit a python script I use. I need to know the number of 3 number combinations in a data set when order does not matter. The expression I'm currently using for the number of 2 number combinations is this:

Combinations = ((Numbers_In_Set-1)/2)*Numbers_in_set

That works perfectly. But now I need to know how many 3 number combinations there are. The answer has to be in a one line form that I can use in my python script and match the results given by this website: http://stattrek.com/online-calculator/combinations-permutations.aspx (http://stattrek.com/online-calculator/combinations-permutations.aspx)

Thanks!


Title: Re: 0.01BTC for some math help :)
Post by: Crossbow376 on April 10, 2014, 09:01:59 PM
It would be n * (n-1) * (n-2) / 6


Title: Re: 0.01BTC for some math help :)
Post by: Crossbow376 on April 10, 2014, 09:03:23 PM
For the details, you can find everything (generalization, example, reasoning, etc) here. http://en.wikipedia.org/wiki/Combination


Title: Re: 0.01BTC for some math help :)
Post by: elgreco on April 10, 2014, 09:09:40 PM
That was perfect!!! Thx!!! Post an addy!


Title: Re: 0.01BTC for some math help :)
Post by: Crossbow376 on April 10, 2014, 09:10:56 PM
That was perfect!!! Thx!!! Post an addy!

Thanks. :)
Bitcoin address:    15eUuxpUmrrWtLM2vvnJ66SebyWXBwnArR


Title: Re: 0.01BTC for some math help :)
Post by: elgreco on April 10, 2014, 09:14:35 PM
Thanks again!

https://blockchain.info/tx/7d7ec86abc1b61f8656fa84ea36805e90d885fb3613621b7b17b1c9c666e1b02