## Combinations and permutations

Welcome to the Combinations generator.

Many years ago, I wrote a small piece of software to list the combinations of this formula. I am grateful to Sean McClean (Thanks Sean!) who visited my website and emailed me. He converted my algorithm into Javascript which I have presented below for your interest. Type in the combination you want and then click calculate and it will list all the combinations available for you.

Carry on reading below for a further explanation of what is happening and why this is useful.

Original algorithm by Peter Webb, Javascript by Sean McClean.

A practical problem for gamblers is the calculation of combinations and permutations. A gambler frequently wants to know how many different ways a smaller number of items can be taken from a larger. This occurs in horse racing, where the number of four-horse accumulators which can be taken from a total of eight selections might be required, or in selecting draws for a treble-chance football pool, where perhaps the number of combinations of eight draws from ten selections are needed.

Each of these problems is an exercise in calculating combinations, although British football pools companies and pools journalists always refer for some reason to the second example, as a permutation.

To be clear there is a difference between Combinations and Permutations.

With a Combination, the order of occurrence doesn’t matter. But with a Permutation, the order does matter.

The answer to both problems is contained in Pascal’s Triangle. Modern calculators and spreadsheets embed a simpler way of working out these calculations. In Excel use the combin(n,r) function, where n is the number of articles and r is the repetitions (combinations).

The full formula is =(n!/((n-r)!*r!))

The “!” in the forumla means factorial. In Excel a factorial is entered =fact(n) where “n” is the number of the factorial you need to work out. In Microsoft Excel there is actually a function to replace the entire confusing formula. The function is “combin”.

If you need to select any 8 combinations from 10 items your answer to the problem should equal 45. In excel test this using =combin(10,8).

Try it out above.