+ Reply to Thread
Results 1 to 13 of 13

number combo generator?

Hybrid View

  1. #1
    Registered User
    Join Date
    04-23-2005
    Posts
    9

    number generator

    thankyou for your reply and questions. To clarify further, if I had five columns of digits (all integers) and needed all possible combinations. Let's say I had the the following integers in column one. (1,3,5). In column two I had (3,5,7). In column three I had (5,7,9,). In column four I had (7,9,11). In column five (9,11,13).

    I need all combinations that are in consecutive order from least to greatest. For example, combinations such as:

    1,3,5,7,9
    1,5,9,11,13

    are allowed

    5,3,7,11,13
    5,5,9,11,13

    are not allowed

    no two numbers are allowed to repeat and any number to the right is not allowed to be less in value to the one to the left.

    Again, any help would be greatly appreciated.

    Thankyou

  2. #2
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    Thanks, that clears up your problem quite a bit. One final question ...

    In your reply, you define 5 sequences, (1,3,5), (3,5,7), (5,7,9,), (7,9,11), and (9,11,13). That yields 7 unique numbers: 1, 3, 5, 7, 9, 11, and 13. You then indicate that the combination 1,3,5,7,9 and the combination 1,5,9,11,13 are acceptable. Both of these happen to be 5 numbers long. So if I understand the logic, then any monatonically increasing sequence of length 5 drawn from the original unique numbers is acceptable; and other acceptable combinations would include:
    1, 3, 5, 9, 11
    1, 3, 5, 9, 13
    3, 5, 7, 9, 11
    3, 5, 7, 9, 13
    etc.

    Correct?

  3. #3
    Registered User
    Join Date
    04-23-2005
    Posts
    9
    That's correct. Also, I didn't mention before but you probably realized, all number sequences are five digits in length.

    Thank you.

  4. #4
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    Quote Originally Posted by yungexec
    That's correct. Also, I didn't mention before but you probably realized, all number sequences are five digits in length.

    Thank you.
    I suspect you meant 5 numbers in length, not digits.

    Attached is a zipped spreadsheet that should do what you want.

    Let me know if this works ...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-23-2005
    Posts
    9
    This is really cool! How can I tweek this so that the results can be displayed in a worksheet with each number in its own cell? I need to be able to have each number in a cell so I can manipulate it further. Also, two other things, one restriction I forgot to mention is that only one number from each column can be used per combination.

    example:

    column one 1,2,3,4
    column two 10,11,12,13
    column three 21,22,23,24
    column four 31,32,33,34
    column five 41,42,43,44

    the first possible combination is going to be 1,10,21,31,41. Not 1,2,3,4,10. The last possible combination is 4,13,24,34,44

    same rules still apply from before. If I were to have a number of less value in any column to the right, the combination is not valid.


    In any case, I really appreciate your time. If you can do this, let me know what I can send you for your time.

    Thankyou,

    yungexec
    Last edited by yungexec; 04-27-2005 at 06:25 PM.

  6. #6
    Registered User
    Join Date
    01-20-2004
    Location
    Western NY
    Posts
    99
    I am happy that the code is close to what you want. Writing the "results" to another worksheet is simple, but before we do that, let's get the basics working correctly

    The other restriction needs clarification. In you original post, you had the same number in multiple columns. For example, "1" was in col 1, col 2 and col 3. If your restriction states that only one number can be drawn from each column, can the number replicated in multiple columns be used multiple times? Should your "rule" be restated as " ... no number can be equal or less than a number to the left ..." ?

    This new restriction does change how things are handled, but tweaking the code to do this should not be too difficult.

    What is the likely # of values per column? The exact number is not important, but the code might be different if the # were 100 vs 5. Similarly, how many columns are typical? Again, the exact number is not important.

    Finally, re "sending me something": this forum is set up to help people. It is expected that as users become more experienced and skilled, they will be able to help others. So, do not just seek help; log on now an again and see if there is someone you can help.

  7. #7
    Registered User
    Join Date
    04-23-2005
    Posts
    9
    Sorry about the unclear specs before. This is the first time I have had to actually try to explain these type of directions to anyone.

    Sometimes there will be duplicate numbers in each column. There cannot be any duplicate numbers per possible combination. No number will be equal to or less than the number to the left.

    Secondly, I'm expecting to use numbers in all five columns. Any combinations found using less than five columns aren't allowed. Also, I anticipate up to six or seven numbers in column one. upto fifteen numbers in columns two thru five.

    This means I am expecting some possible over flow of combinations onto a second worksheet (hopefully not a third).

    Again thankyou very much.

    P.S. Are there any good resources for beginners that I can get my hands on to read and teach my self VB. I'm sure this sight if full of useful informationk, I just haven't had time to look thru it all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1