Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2015-01-16 14:34:32

Nick Meyers
Guest

Combination Problem

My background is in Biology and Nursing, so I have no idea how to approach this problem.  I would like to know how to solve it, or learn how to solve it with excel or break it down with a tool like this Combinations and Permutations Calculator http://www.mathsisfun.com/combinatorics/combinations-permutations-calculator.html

Any advice on where to begin, or topics I can read would be appreciated! Or if you could solve it i'd be amazed!

There are 10 match ups with 2 players (A-T).  Each player is a set price (7-13).

How many combinations cane be made, when only 5 players are picked and the total of all 5 is less than or equal to 50? And what are those combinations?  Example (A, D, G, M, S) = 49, with the order not counting as a new item such as (A, D, G, S, M).

Data set:

A-12
B-7

C-10
D-9

E-7
F-13

G-11
H-9

I-8
J-13

K-10
L-10

M-8
N-11

O-11
P-9

Q-7
R-11

S-9
T-12

Is there any program where I could input this information and it would give me the number of combinations that could be made along with the actual items listed as well.  Seeing the combinations is just as important as knowing the number of combinations. The order within the 5 that are less than or equal to 50 is not important.


Thank you to anyone who reads this, and any help would be greatly appreciated!

#2 2015-01-17 04:19:55

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

Hello,

This is a restricted partition problem from a multiset. I have run it off by computer and the answer s 206.

For an analytical answer I have sent it off to bobbym.

Last edited by ElainaVW (2015-01-17 06:45:12)

Offline

#3 2015-01-17 07:53:18

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Thank you so much Elaina! I am happy it can be solved!  I would really like to do more problems like this in the future.  While the number of combinations is important, I would also like to be able to see a list of the qualifying combinations.  Is this possible? Could you tell me which computer program you used?

Offline

#4 2015-01-17 08:30:26

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

Hello,

I used a program called Mathematica but if you program it probably can be done in any other language.

Offline

#5 2015-01-17 08:43:42

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Thank you,

I'll look into that program.  I have no experience programming, do you think Mathematica could be used by someone who doesn't have a math background?

Did it generate a list of the combinations or did it just give a number?

Offline

#6 2015-01-17 08:49:50

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

It can do both easily but will be very difficult for someone without a math background.

There are a couple of users here that would show you what to do.

If you need to do many of these type problems you can always bring them in here and someone will do them for you.

Offline

#7 2015-01-17 10:02:39

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Thanks for the help Elaina! Eventually I would like to be able to learn how to use the program, but I understand it may take a lot of work.

The first problem I posted was a sample to explore if it were possible and I was hoping for a number under 1000 for it to be useful, and you got 206.  Which was great.

Here is the same problem, with a new data set and the total changed from 50 to 500. If you have a chance, would you be able to run this set as well and attach a list of the combinations to my email ndmeyers@gmail.com ? Is it possible to export the list from the program? I would like to see what the data looks like.

Thank you so much for your help!


Problem:

There are 10 matches (A vs B, C vs D, E vs F, etc.).
Only one player from each match can be used.
5 players must be picked.
The total combined cost of the 5 picked, must be less that or equal to 500.
All combinations over 500 are not important.

I need to be able to generate a list of combinations, that fit this criteria, along with associated prices.


Data Set:

Match    Cost
1    A    91   
      B    109   

2    C    104   
      D    95
   
3    E    79   
      F    120   

4    G    86   
      H    114   

5    I    106   
      J    94
   
6    K     80   
      L     118
   
7    M    75   
      N    127
   
8    O    103
      P    97
   
9    Q      107   
      R    93
   
10   S    94   
      T    105

Offline

#8 2015-01-17 10:37:12

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Combination Problem

Hi NickMeyers

Welcome to the forum! smile

There are 6304 combinations for the new list.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#9 2015-01-17 10:45:26

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Hi and Thank you!!

How were you able to solve this question, and what program did you use?

Offline

#10 2015-01-17 10:46:49

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Combination Problem

The one Elaina mentioned above, Mathematica.


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#11 2015-01-17 10:47:18

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

Hello,

Sorry, it is less than so 6304 is correct.

Last edited by ElainaVW (2015-01-17 10:48:22)

Offline

#12 2015-01-17 10:56:36

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Elaina, I am not sure what you are referring to. Did you think it was greater that 500, is that what you were referring to?

What would the number be if the restraint were changed from less than or equal to 500 and greater than or equal to 480?  So in the 480-500 range?

Also are you able to export the list of combinations and email them to me?

Thank you so much for the help!

Offline

#13 2015-01-17 11:01:19

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

I just read the problem wrong there is nothing wrong with 6304.

3381 for >=480 and <=500

I will see if I can make a text file with the results.

Offline

#14 2015-01-17 11:16:55

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Thank you for your help!

How low does it get for >=490 and <=500 or >=495 and <=500?

I really appreciate this!

Offline

#15 2015-01-17 11:20:20

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

Last edited by ElainaVW (2015-01-17 11:42:05)

Offline

#16 2015-01-17 11:29:04

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Combination Problem

Hi ElainaVW

Could you hide that?


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#17 2015-01-17 11:51:57

ElainaVW
Member
Registered: 2013-04-29
Posts: 580

Re: Combination Problem

I did.

Offline

#18 2015-01-17 11:59:41

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

This is so cool! Thank you! For the help!

Offline

#19 2015-01-17 12:03:48

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Combination Problem

Hi ElainaVW

Thanks.

Hi NickMeyers

One question - does it matter if J or S was chosen in the last example?

Last edited by anonimnystefy (2015-01-17 12:04:09)


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#20 2015-01-17 12:41:38

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

Now I see, It would be better if the results were in letter form, because I cannot distinguish if 94 is J or S...

Yes J and S are separate, it would matter...does that change things? Does it double the number of combinations with 94 involved?

Last edited by NickMeyers (2015-01-17 12:49:42)

Offline

#21 2015-01-17 12:50:14

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Combination Problem

I think it does. I am getting 8030 possibilities now. I'll wait for ElainaVW to confirm or correct me.

Last edited by anonimnystefy (2015-01-17 12:50:58)


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#22 2015-01-17 14:24:09

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,974
Website

Re: Combination Problem

ElainaVW wrote:

Hello,

This is a restricted partition problem from a multiset. I have run it off by computer and the answer s 206.

For an analytical answer I have sent it off to bobbym.

Hi Elaina;

I'm getting an answer of 9763. Can you check?

In[7]:= Select[
  Subsets[{12, 7, 10, 9, 7, 13, 11, 9, 8, 13, 10, 10, 8, 11, 11, 9, 7,
     11, 9, 12}, {5}], Total[#] <= 50 &] // Length

Out[7]= 9763

Also,

data Player = Player Char Int

instance Show Player where
        show (Player name _) = show [name]

players = zipWith Player ['A'..'T'] [12,7,10,9,7,13,11,9,8,13,10,10,8,11,11,9,7,11,9,12]

choose :: [b] -> Int -> [[b]]
_      `choose` 0       = [[]]
[]     `choose` _       =  []
(x:xs) `choose` k       =  (x:) `fmap` (xs `choose` (k-1)) ++ xs `choose` k

value (Player _ x) = x

check n = filter (\p -> sum(map value p) <= 50) (choose players 5)

main = print $ check 5

gives this.

Last edited by Agnishom (2015-01-17 14:26:03)


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#23 2015-01-17 14:46:26

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Combination Problem

Hm, is that Haskell?


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#24 2015-01-17 15:09:45

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,974
Website

Re: Combination Problem

Yes, and I am getting 4166 for the new problem. hmm


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#25 2015-01-17 15:13:03

NickMeyers
Member
Registered: 2015-01-17
Posts: 46

Re: Combination Problem

This list is great and I am finding it very useful, I just have to make sure that the numbers don't have players in the same match. I am going though the list and am finding various combinations that don't fit the constraints. 86 is G and 114 in H and they are in the same match along with other combinations with players in the same match. One thing I was hoping to rule out were combinations with players from the same match.  Is that possible?

G and H are the only 86 and 114 in the set. I pasted a sample from the list posted earlier:

{79, 86, 91, 109, 127, 492}
{79, 86, 91, 114, 118, 488}
{79, 86, 91, 114, 120, 490}
{79, 86, 91, 114, 127, 497}
{79, 86, 91, 118, 120, 494}
{79, 86, 93, 95, 127, 480}

If it's easier to generate a list of all combinations of any value that would still be useful.  But the important part is that only one player from each match be used. This list and combinations number includes combinations from players in the same match and doesn't fit the constraints.  Could this mean that this number is larger than it should be? What do you think?

Thanks for all the help!

Last edited by NickMeyers (2015-01-17 15:44:57)

Offline

Board footer

Powered by FluxBB