...

View Full Version : How to generate combinations



coolguyraj
03-14-2009, 12:33 PM
Hi,

I want to generate a combination of numbers.

Example:Generating all cobination of arranging 5 numbers out of the given 30.

if i have 30 numbers and i pick 5 at a time i can arrange this in 142506 different ways. the numbers 5 and 30 should be dynamic .(If i change 5 or 30 it should be able to generate corresponding number of combinations.)


This is the first 20 combinations.

How can i generate this and dump it into a table in MySQL.

0 1_2_3_4_5_ 0
1 1_2_3_4_6_ 0
2 1_2_3_4_7_ 0
3 1_2_3_4_8_ 0
4 1_2_3_4_9_ 0
5 1_2_3_4_10_ 0
6 1_2_3_4_11_ 0
7 1_2_3_4_12_ 0
8 1_2_3_4_13_ 0
9 1_2_3_4_14_ 0
10 1_2_3_4_15_ 0
11 1_2_3_4_16_ 0
12 1_2_3_4_17_ 0
13 1_2_3_4_18_ 0
14 1_2_3_4_19_ 0
15 1_2_3_4_20_ 0
16 1_2_3_4_21_ 0
17 1_2_3_4_22_ 0
18 1_2_3_4_23_ 0
19 1_2_3_4_24_ 0


Thanks

mlseim
03-14-2009, 07:25 PM
Why does this look so familiar?

Oh, I remember now: http://www.codingforums.com/showthread.php?t=159262

Was there never a solution to that?

coolguyraj
03-15-2009, 07:57 AM
i want the sequence to be generated and insered into the database.

mlseim
03-15-2009, 10:15 PM
I thought that when others were trying to help you
with this, there was mention of "out of memory", or
PHP script timeout failures.

Unless you have your own server, I don't think it can be done.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum