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

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 92,926

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.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

**Online**

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 92,926

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.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

**Online**

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 92,926

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.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

**Online**

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

I get it now. Thanks for explaining!

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 92,926

Hi Blitz;

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

**In mathematics, you don't understand things. You just get used to them.**

**Online**

Pages: **1**