Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2012-11-07 11:25:20

Blitz
Member
Registered: 2012-11-07
Posts: 4

### combination number...

Hi,

I`ve carefully read this site's in depth explanation regarding combinations and permutations and I`ve learned a lot.

However... I have two questions:

1. I am still searching a formula that can give me the RANKING POSITION of a combination. I`ll give an example:

lottery numbers : 5 numbers are chosen from 50 numbers. this gives 2118760 possible combinations, from 1-2-3-4-5 to 46-47-48-49-50.
Now I need a formula that gives me the ranking position (from 1 to 2118760), when I enter the 5 chosen numbers in the formula. For example, combination 1-2-3-4-6 should return ranking position #2, combination 1-2-3-4-7 should return 3, and so on.

What is the formula for this?

2. I have noticed that the Combinations and Permutations Calculator on this site calculates the result at any keystroke. This makes me believe it uses a non-recursive factorial function. So far, I haven't found any non-recursive factorial math function (to use in visual basic for example). I have used a recursive factorial function so far, but when the number of possible combinations gets too high, I get -an expected- stack overflow. What function does this website use?

Offline

## #2 2012-11-07 11:56:34

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: combination number...

Hi Blitz;

A couple of questions, usually formulas are given for permutations.

Do you want {1,2,3,4,5} to be different than {5,4,3,2,1}? Then we are dealing with a permutation.

There is an algorithm to do this:

Let's say you want the position and I have picked small numbers to better illustrate, {4,7,9,10,11}

For {1,2,3,4,7} we get:

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #3 2012-11-09 10:32:43

Blitz
Member
Registered: 2012-11-07
Posts: 4

### Re: combination number...

bobbym wrote:

A couple of questions, usually formulas are given for permutations.

Do you want {1,2,3,4,5} to be different than {5,4,3,2,1}?]

No, so I think we're talking about combinations here.

Can you explain your example please, because I don't see how {4,7,9,10,11} results in your formula

and how do you write

as a plain formula?

Offline

## #4 2012-11-09 12:47:27

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: combination number...

Hi Blitz;

Like with the permutations there is no formula just an algorithm or method.

For the second question:

so

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #5 2012-11-11 12:01:04

Blitz
Member
Registered: 2012-11-07
Posts: 4

### Re: combination number...

Blitz wrote:

So here's the same question : Can you explain your example please, because I don't see how {4,7,9,10,11} results in your algorithm. I don't see the link between 4,7,9,10,11 and the numbers in your algorithm:

Thx for clarifying the second question.

Offline

## #6 2012-11-11 12:26:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: combination number...

Hi;

Supposing we have {4,7,9,10,11} out of the numbers 1 to 20.
The first combination is 1,2,3,4,5 and the last is 16,17,18,19,20.

Start with the first number which is 4.

There are 19 C 4 combinations of the type 1,xxxx
There are 18 C 4 combinations of the type 2,xxxx
There are 17 C 4 combinations of the type 3,xxxx

so we have

There are 15 C 3 combinations of the type 4,5 xxx
There are 14 C 3 combinations of the type 4,6 xxx

so we have

There are 12 C 2 combinations of the type 4,7,8 xx

so we have

add 1 for the next one.

Want to do another?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #7 2012-11-12 12:05:54

Blitz
Member
Registered: 2012-11-07
Posts: 4

### Re: combination number...

I get it now. Thanks for explaining!

Offline

## #8 2012-11-12 12:11:45

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: combination number...

Hi Blitz;

You are welcome. You understood that fast, very good.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline