Results 1 to 7 of 7

Thread: Grouping Numbers

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    didn't decide yet
    Posts
    222

    Grouping Numbers

    Hi to all,

    I have a range of 30 integer numbers (see attached zip), which i want to group them in 4 teams and one of the following requirements must be met

    1)the sum of the numbers in each team to be the same

    or

    2)the sum of the numbers in each pair of teams to be the same

    any ideas??
    Attached Files Attached Files
    • File Type: zip s.zip (850 Bytes, 55 views)
    Last edited by tolisss; Jul 28th, 2004 at 11:34 AM.
    Come and get our ISDN CallerID http://www.3wm.biz

  2. #2
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Just my thoughts....

    You could start out taking groups of two (or larger) and try to create groupings that equal each other as a seed (I am not certain that you could have teams that are of different lengths.) and then start adding equal groups as such.

    I could see some potential difficulties with this solution though (if you find that the rest of the numbers cannot be divided equally among the rest of the groups, then you will have to throw the run out.)
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  3. #3
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    I'd suggest writing a program to brute force it. 40 numbers un any order... that's only:
    40! = 8.157 * 10^47 calculations

    Only take a few days.

    Maybe you'll need a genetic algorythm.

    *Edit*
    No wait! You only need to try 4 values on each number once. So:

    4^40 = 1,21 * 10^24

    That's much less. Maybe a few hours. Ok maybe days instead of weeks.
    Don't pay attention to this signature, it's contradictory.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    didn't decide yet
    Posts
    222
    thnks for the reply guys. but if u could post some sort of implementation to help me....

    i m still very confused
    Come and get our ISDN CallerID http://www.3wm.biz

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    OK... the teams are going to be unequal amounts of numbers...

    30 numbers
    4 teams

    The list of numbers happens to total 1000
    so for rule 1 - each team must be 250
    rule 2.. uh well I think this has a lot more flexible results...

    Sounds like a logic problem or an upper level maths problem.
    Where did it come from?

    Vince

    <edit>
    I notice all the numbers are divisible by 6 (the lowest denominator)
    - something there perhaps?
    <edit>
    Except 10
    </edit>
    </edit>
    Last edited by Ecniv; Aug 5th, 2004 at 09:24 AM.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    didn't decide yet
    Posts
    222
    it is not just happen but always the sum of all number is equal to 1000. This algorithm i m trying to build is for a statistical program i m trying to build for a lucky game like LOTTO.

    I want to make a generic algorithm to produce the 4 teams i stated above so i can use it thorough out my program.
    the numbers are going to change but their total sum will always be 1000
    Come and get our ISDN CallerID http://www.3wm.biz

  7. #7
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Uh well you may want different numbers then

    Had a go thought it may be possible.. but I don't think it is with these numbers.

    1) Can only get one team of 250 - the rest are 240 or 260 perhaps

    2) this is the one I really thought would work - but doesn't appear too. OK, so I based it on the division by 6 - but if only one 10 is outside that division then it won't balanec (two teams equal)...

    Attached is my attempts - sorry I couldn't help. A rethink is in order I believe


    Vince
    Attached Files Attached Files
    • File Type: zip s.zip (9.9 KB, 45 views)

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width