Department of Science & Math

E = mc²

Science journals of interest: Scientific American - Nature - New Scientist - Science AAAS - Science Daily

LAST EDITED: March 17, 2015

Yeano's thread: Proving Something is Independent of our Axioms.
Yeano's thread: Algebraic Topology and Model Theory

We have LaTeX running on GT! Thanks to Xhin!

Blackjack Dice Puzzle
Posted: Posted June 13th by Xhin
 Your goal is simple. Make your dice the most likely to add up to 21. 1. Choose a dice type D4 D6 D8 D10 D12 2. You can have any number of that dice type. What's the best strategy and why? Advanced : can you come up with a formula that is represented in D (faces on the die) and N (number of dice)?
settingsOptions
There are 16 Replies

I'll make a statistical analysis program for this later.

Posted June 13th by Ghowilo
Ghowilo

This is going to take 2 posts.

I used the following die: d4, d6, d8, d10, d12, and d20. Each iteration, I start at 2 die and work my way up to 20 die. For each number set of die, I roll them 20,000 times.

Posted June 13th by Ghowilo
Ghowilo

bullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from repliesbullshit to hide from replies

Edited June 13th by Ghowilo
Ghowilo

Interesting, it looks like 8d4 is the best, at least statistically.

Posted June 13th by Xhin
Xhin

I'll do some of the same analysis that Ghowilo did later, but for now a couple of easy observations:

*If you have n dice with d faces, you can get every possible value from n to nd.

*To get to 21, you need enough dice to add up to that amount. So nd has to be at least 21. For instance, you need at least 6 D4 to have a chance of getting 21.

*The most dice you could use is 21, since any more than that and you're guaranteed to get at least 22 points.

Posted June 13th by EN
EN

data dump:

4:[0.0136,
0.0687,
0.1166,
0.1032,
0.0621,
0.0222,
0.0083,
0.0016,
0.0001,
0.0,
0.0001,
0.0,
0.0,
0.0,
0.0,
0.0]

6:[0.0146,
0.0664,
0.094,
0.0645,
0.029,
0.0092,
0.0011,
0.0002,
0.0002,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0]

8:[0.0194,
0.0684,
0.0719,
0.0405,
0.0147,
0.0043,
0.0007,
0.0001,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0]

10:[0.0522,
0.0684,
0.0367,
0.0141,
0.004,
0.001,
0.0004,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0]

12:[0.0266,
0.0623,
0.0442,
0.0178,
0.0045,
0.0012,
0.0002,
0.0001,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0]

Each list shows, for the minimum n up to the maximum of 21, what the probability of rolling a 21 is after 10000 trials. The best seems to be rolling 8 4-sided dice.

Posted June 13th by EN
EN

For interest's sake, let's look at imaginary 2 and 3 sided dice:

2:[0.0058,
0.0579,
0.1506,
0.2132,
0.1551,
0.065,
0.0191,
0.0024,
0.0002,
0.0,
0.0]

3:[0.0003,
0.0183,
0.0811,
0.141,
0.1392,
0.0801,
0.0342,
0.0078,
0.0015,
0.0002,
0.0,
0.0,
0.0,
0.0,
0.0]

You can see that 14 2-sided dice gives the best chance (21%), followed by 10 3-sided dice (14%).

I feel like there's a closed for solution I get get for the best number of dice to roll per d, but I haven't tried yet.

Posted June 13th by EN
EN

So, here's some intuition. Think about rolling two D6. You can hit every value between 2 and 12, and the distribution is symmetric about the mean of (2 + 12)/2 = 7.

The average value of the range is the value most likely to be rolled in this case. This should be (roughly?) true in general. Whatever the range of possible values, the most likely value should be the value in the middle of that range.

In our case, the range is n (rolling all 1s) to dn (rolling all ds). So if we want 21 to be the most likely value to get rolled, we want 21 to sit right in that middle.

Thus, for a given d, we want to pick the n that makes (n + dn)/2 as close to 21 as possible.

For D=2, this value is 14, as (14 + 2*14)/2 = 21, which is exactly what we want.

For D=4, this value is 8, as (8 + 4*8)/2 = 20.

As D increases, the range of variation that you get for each additional die is larger, which is why the smaller D values give you the best probability of getting 21. In the extreme case, if you had 1-sided dice you should pick 21 of them, as you'll have a 100% chance of winning.

If we know that we want (n + dn)/2 to be close to 21, that implies that n should be close to 42/(1 + d).

Posted June 13th by EN
EN

There a user here on gametalk named dice.

Posted June 13th by weid man
weid man

I think there is a function in Number Theory that could give us the number of ways that a whole number (positive integer) X can be written as a sum of N integers from the set {1,2,...,m}. For simplicity, I shall call this number of ways $$F_{m,N}(X)$$.

Given an n-sided die Dn (with numbers labeled by {1,2,...,m}), and given that you would choose N such die, the sample space size is $$m^N$$. So the probability of rolling a total of X is

$$\Large{\frac{F_{m,N}(X)}{m^N} }$$.

If the function F could be identified from Number Theory, then these probabilities can be calculated for the case at hand for $$m = 4, 6, 8, 10, 12$$ and see which of these has the larger value for various N (and what N is for each given m). One should then be able to see which gives the greater probability.

Edited June 18th by The Fly
The Fly

From Number Theory we know that the number of distinct rolls of n d-sided dice is $${d+n-1}\choose{d}$$. In this case distinct means that rolling a 1 on the first dice and a 4 on the second is the same as rolling a 4 on the first and a 1 on the second. I don't know if that's what we want to count, but if so it would probably be our denominator instead of $$d^n$$.

@Xhin: What do you think of all of this?

Edited June 19th by EN
EN

Yes, you can do it that way too. I just find it bit easier as I described since you can write down the sample space more directly. If there are repeats or multiplicities, they would cancel out when working out the probabilities.

Posted June 20th by The Fly
The Fly

I'd like to propose a breakdown of the problem to a simpler one if I may. Just consider the D4 case - that of 4 sided dice. The question would now be: how many die of this type would be the best strategy? As EN noted, you'd have to have at least 6 of them. Does 6 give the greatest probability for the sum to be 21? Or would it be 7? 8? etc.

I worked out the probability for 6 die of type D4 to add up to 21. I got

$$p_6 = \frac{56}{4^6} = \frac{7}{512} = 0.01367...$$.

Is this what you got EN and Xhin? That sounds rare but it'll be good to see what 7 die would give. Bigger or smaller probability.

Edited June 21st by The Fly
The Fly

I calculated that if you choose 7 die (of type D4), the probability increases to

$$p_7 = \frac{1128}{4^7} = \frac{141}{2048} = 0.0688...$$.

It will probably also increase if you choose 8 die. However, as EN observed, choosing 22 die will never give a sum of 21. And even 21 die will yield only one event in a sample space of size $$4^{21}$$ which is hugely small! So I think we can make a reasonable guess that the number of die should be the middle between 5 die (which gives zero probability) and 22 (which also gives 0 probability). What number lies in the middle of these? I'd pick 14 die of type D4 to give the greatest probability in the D4 subproblem. Just my guess if this thing grows like a binomial distribution.

I bet you can do the same for the other die types -- pick out the middle number of die and compare those middles.

Xhin, EN, does this makes sense? Does it agree with your calculations?

Edited June 21st by The Fly
The Fly

Xhin: Interesting, it looks like 8d4 is the best, at least statistically.

My calculations would seem to agree. But 9, 10, ... 14 might even get progressively better. But I'm not certain! Since the probability will have to go back down to 0 with 22 die (of type D4), it would seem that the closer we are to 19, 20, 21 die the smaller the probability becomes. It's like a normal distribution that goes up for a while and then goes back down.

Edited June 21st by The Fly
The Fly

Let's do a simpler problem first. We have to stop thinking of 21 for the moment since the problem depends on other of its 'subintegers'. Take any positive integer M. How many ways can you write it down as a sum of two positive integers from the list {1,2,3,...,n}? I call this number $$W_2(M,n)$$. Here is a formula that can probably be checked to see if I got it right:

$$W_2(M,n) = \begin{cases} M-1 & if \ \ 2 \le M \le n \\ 2n-M & if \ \ n < M < 2n \\ 1 & if \ \ M = 2n \\ 0 & if \ \ M > 2n \ \ or \ \ M = 1 \end{cases}$$

It is very case dependent, as you can see. We'll then have to use induction in iterating it to get sums for 3, 4, ... integers. That is, to get $$W_3(M,n), W_4(M,n) ...$$ etc in a recursive way since you can write each of them in terms of the previous one.

Edited June 21st by The Fly
The Fly