Combinations (not permutations) of numbers

 DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

# Thread: Combinations (not permutations) of numbers

1. Registered User
Join Date
May 2006
Posts
2

## Combinations (not permutations) of numbers

Does anyone have a method that I could use to print (or anything) all combinations (so, 123 and 321 are the same) of given numbers, or even something that would do the same to objects??

2. Registered User
Join Date
Jul 2004
Posts
83
you want the different ways 123 could be printed? ex:
123
132
213
231
312
321
?

3. Senior Member
Join Date
Mar 2004
Posts
635
so you dont want all combinations, just all groups.

S = set of all numbers
C = number of elements in a combination, or group

So all possible groups equals S!/C!

4. Registered User
Join Date
May 2006
Posts
2
Ummm... I don't think you got me...
Permutations, variations and combinations are not the same thing... Permutations are when total number of elements and a number of elements in a group are the same, so you just change their places (so, ordering metters)... variations are when you can group less elements than the maximum, but ordering still metters, and combinations are the same as variations except that ordering does not metter ie. 123, 213 and 321 are the same... and combinations are exactly what I need...
I want my program to take n elements and print out all combinations, meaning from combinations with 1 element to those with all n elements...
Any ideas??

Thanks

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise
 Questions? Contact us. C++ Web Development Wireless Latest Tips Open Source