I would like to calculate the probability of each potential outcome for the following problem:

There are 20 envelopes and a person chooses 4. The matrix for each envelope is as follows:

Envelope Amount
1 25
2 25
3 25
4 25
5 20
6 20
7 15
8 15
9 10
10 10
11 5
12 5
13 5
14 5
15 5
16 5
17 5
18 5
19 5
20 5

The prizes are as follows when adding up the total amount:
100 wins $5,000
90 – 99 wins $2,500
80 – 89  wins $1000
70 – 79 wins $700
60 – 69 wins $600
50 – 59 wins $500
40 – 49 wins $400
30 – 39 wins $300
20 – 29 wins $200

The max score is 100 and the minimum is 20. I calculated a total of 4,845 combinations but I wanted the probability of each possible outcome (score) and an average score. The goal is to have $300 to be the average payout but I may have to change the numbers in the envelopes.

For example, if I choose 4 envelopes and they are a 5, a 10, a 10, and a 25 for a score of 50, what is the probability of that happening? Or all 4 envelops are all 5's? and so on and so forth...

I appreciate any assistance I can get and hopefully I explained it clearly. If not, as me for more input and I appreciate your time. Thank you. 
  • This is the kind of thing I would do with programming, like R or python, not by hand with some formula. Would that be an acceptable solution?


Answers can be viewed only if
  1. The questioner was satisfied and accepted the answer, or
  2. The answer was disputed, but the judge evaluated it as 100% correct.
View the answer

1 Attachment

  • Is this python? And if so, if there a free version to run this script?

  • Yes, if you do not know how to install it I suggest the following. I will try to upload a text file, since copy-pasting the answer yields some formatting issues. Download the text file and open in your browser. Paste the code in. Alter the parts that describe the number of envelopes and their score amounts, without breaking the code. Hit the run button.

  • The reason I am asking is I am not familiar with it and how do I get my answers?

  • Sorry, I just seen your comment.

  • I followed your instructions, and this is what came up below. File "/tmp/sessions/5a3561512bd2b2cc/", line 1 𝚒𝚖𝚙𝚘𝚛𝚝 𝚒𝚝𝚎𝚛𝚝𝚘𝚘𝚕𝚜 ^ SyntaxError: invalid syntax

  • I would love to be able to run it so if I change the amounts, it recalculates the probabilities. I am on the site mentioned but that invalid syntax shows up.

  • Hi, please copy the text from the pdf file and not the answer itself. If this still doesn't work let me know. You can change the amounts by altering the parts that say "amounts", "brackets", and "prizes".

  • It is working now. Thank you.

The answer is accepted.
Join Matchmaticians Affiliate Marketing Program to earn up to 50% commission on every question your affiliated users ask or answer.