Bitcoin Forum
June 23, 2024, 05:56:34 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: (CLOSED) 0.01BTC for some math help :)  (Read 406 times)
elgreco (OP)
Full Member
***
Offline Offline

Activity: 147
Merit: 100



View Profile
April 10, 2014, 08:51:45 PM
Last edit: April 10, 2014, 09:16:11 PM by elgreco
 #1

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

Thanks!

1E1GrECoNP1RpvWe72kS5cDZozA47nUFs4
Crossbow376
Hero Member
*****
Offline Offline

Activity: 615
Merit: 500



View Profile
April 10, 2014, 09:01:59 PM
 #2

It would be n * (n-1) * (n-2) / 6

Crossbow376
Hero Member
*****
Offline Offline

Activity: 615
Merit: 500



View Profile
April 10, 2014, 09:03:23 PM
 #3

For the details, you can find everything (generalization, example, reasoning, etc) here. http://en.wikipedia.org/wiki/Combination

elgreco (OP)
Full Member
***
Offline Offline

Activity: 147
Merit: 100



View Profile
April 10, 2014, 09:09:40 PM
 #4

That was perfect!!! Thx!!! Post an addy!

1E1GrECoNP1RpvWe72kS5cDZozA47nUFs4
Crossbow376
Hero Member
*****
Offline Offline

Activity: 615
Merit: 500



View Profile
April 10, 2014, 09:10:56 PM
 #5

That was perfect!!! Thx!!! Post an addy!

Thanks. Smiley
Bitcoin address:    15eUuxpUmrrWtLM2vvnJ66SebyWXBwnArR

elgreco (OP)
Full Member
***
Offline Offline

Activity: 147
Merit: 100



View Profile
April 10, 2014, 09:14:35 PM
 #6

Thanks again!

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

1E1GrECoNP1RpvWe72kS5cDZozA47nUFs4
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!