Quick Math Combination Question

Associate
Joined
19 Jun 2010
Posts
1,695
Location
Southampton City Centre
Just here at work and stupidly us developers can't find the easiest way to figure out how many combinations of the numbers 1-7 there are, regardless of order.

So 1,2,3 is the same as 3,2,1.

Any quick solutions out there?

My google-fu is weak.
 
It's "maths".

And i think there's an algorithm for this, i vaguely remember it from GCSE. But i can't remember what it's called. I'll have a look for you...
 
If you have a scientific calculator there is an easy way to do this. Type in 7! which is the same as 7x6x5x4x3x2x1. The answer is 5040.
 
It's "maths".

And i think there's an algorithm for this, i vaguely remember it from GCSE. But i can't remember what it's called. I'll have a look for you...

You need to capitalise your I's, also sentences shouldn't start with and or but.

Appreciate it. :)
 
Think of it as this.

I have 7 products on my website. I want to create a link for every possible combination that people could buy those.

Hence why order doesn't matter. If I bought products 3, 5 and 7. It's the same as me buying 5, 7 and 3.

So the above is only 1 link. How many links to cover all products?
 
You need to capitalise your I's, also sentences shouldn't start with and or but.

Appreciate it. :)

Spelling before grammar ;)

On a calculator it's called the factorial function, the "algorithm" would just be something like x*(x-1)*(x-2)... until you get to one.

Although for some reason my stupid brain thought that you could potentially also do it with bubble sort and the maximum number of passes function...
 
If you have a scientific calculator there is an easy way to do this. Type in 7! which is the same as 7x6x5x4x3x2x1. The answer is 5040.

This is correct the factorial of the number of items you want to arrange will give you the possible number of combinations.

Simple set would be 1 and 2 so possible combinations are:
1 2
2 1
Two, thus the factorial of 2 (2!) is 1x2 = 2.

QED
 
We could right them out! :D

First, all the ones:

1, 2, 3, 4, 5, 6, 7

Now all twos

1 2, 1 3, 1 4, 1 5, 1 6, 1 7,
2 3, 2 4, 2 5, 2 6, 2 7
3 4, 3 5, 3 6, 3 7
4 5, 4 6, 4 7
5 6, 5 7
6 7

... I'm bored now
 
This is correct the factorial of the number of items you want to arrange will give you the possible number of combinations.

Simple set would be 1 and 2 so possible combinations are:
1 2
2 1
Two, thus the factorial of 2 (2!) is 1x2 = 2.

QED

Except that in the ops case 1 and 2 is the same as 2 and 1 and his answer would be 1.....................
 
how many combinations of the numbers 1-7 there are, regardless of order.

So 1,2,3 is the same as 3,2,1.

if it is regardless of order that makes a big difference

Type in 7! which is the same as 7x6x5x4x3x2x1. The answer is 5040.

i dont think this is correct as this takes 123 and 321, etc as different numbers

Is it not just 7C3?

= 35

i think this is the correct way as you are looking for "combinations" not "factorials" :)
 
Okay, 127 must be the right answer, if order doesn't matter.

If you only want one number, then you have 7C1 (ie: 7) to choose from.

If you want two numbers, you have 7C2=21 to choose from.

If you want three numbers, you have 7C3=35 to choose from.

7C4=35
7C5=21
7C6=7
7C7=1

1+7+21+35+35+21+7 = 127

[This assumes that order does not matter. Ie - if you pick number 5 and 2, that's the same as 2 and 5]
 
Except that in the ops case 1 and 2 is the same as 2 and 1 and his answer would be 1.....................

Ah comprehension fail. Sorry. Quick google found this:

Combinations

Combinations are unique subsets of objects, ignoring order. The number number of 5 card poker hands that can be dealt from a 52 card deck is a combinations problem. The 120 (i.e. 5!) different arrangements of cards in a hand containing 10,J,Q,K,A of hearts are all the same in terms of combinations. This is true of every other hand, so you can see that there a many fewer combinations than permutations of things. In fact, there are always 1/R! fewer combinations than permutations, so the total combinations for R of N objects is the number of permutations divided by R!, i.e. N! /(N-R)! / R!. For our 2 of 5 example this is 5!/3!/2!=10. For poker hands the total number is 52!/47!/5!=2,598,960.
 
Back
Top Bottom