Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2005
    Posts
    93
    Thanks
    5
    Thanked 0 Times in 0 Posts

    How to generate combinations

    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

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    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?

  • #3
    New Coder
    Join Date
    Nov 2005
    Posts
    93
    Thanks
    5
    Thanked 0 Times in 0 Posts

    i dint get the solution to this problem.

    i want the sequence to be generated and insered into the database.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    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.


  •  

    Posting Permissions

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