Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

More statistics of dice rolls

Marsal

Arcane
Joined
Oct 2, 2006
Messages
1,304
Found some time to look into the problem, gave up and applied brute force. You were right (partially). It seems that the answer is 29 (bit less, if you don't look at rolls as integers). Try to code it yourself, maybe I fucked something up. Tested on 10M sample groups, a couple of times, with different seeds, it gives ~50.4% probability.

Now you just have to come up with the correct formula :)

EDIT: "Right, so how many times do you flip a coin to get two heads in a row?" Tried it and the answer is 4. Didn't read your or Elwro's long posts, is this wrong? If it is, disregard the above post.

Secretninja said:
Why are you even helping this faggot Marsal?

Are you missing a comma, or am I the faggot in your post? I like a challenge and this seemed a pretty straightforward problem. I guess I should have remembered that I suck at this part of mathematics. Too late now.
 

Elwro

Arcane
Joined
Dec 29, 2002
Messages
11,748
Location
Krakow, Poland
Divinity: Original Sin Wasteland 2
Marsal said:
EDIT: "Right, so how many times do you flip a coin to get two heads in a row?" Tried it and the answer is 4. Didn't read your or Elwro's long posts, is this wrong?
No, it's correct if your goal is to have probability=1/2 and it's correct because 8 out of 16 4-element 01-sequences fulfill the success criteria.

I'll probably have time to go back to the mathematics needed to generalize my reasoning with Z_n and B_n (because the original was wrong and I should've seen the stupitidy of the conclusion - chance growing over 1 - from the start) Tuesday morning.
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
I think the confusion might be we are looking for different things *. Maybe what I am looking for is the median and you are looking at the mean. I also suck at conceiving probabilities though I like finding the solutions.

Did you look at that paper? It looks at it as a Markov Chain problem, the nature of the outcomes change depending on whether you are looking for the first success or the second. I put it into words in my last post because I don't know how to express it mathematically.

* According to graphs it seems that way. The (# trials to cover area 0.5) seems to be 4 flips, but the average is 6.
 

Marsal

Arcane
Joined
Oct 2, 2006
Messages
1,304
To be honest, I don't care that much about the subject at hand to read long posts or papers. Sorry.

I'll just lurk in the shadows and point out obvious mistakes :) Is your goal to answer the question or to learn how to answer the question? IMO 15 min of coding is much easier (and less mistake prone) to do, than fiddle with formulas you are not comfortable with (at least for "simple" problems).
 
Joined
Aug 25, 2009
Messages
1,548
Location
Barad-dûr
Elwro said:
Hobbit Lord of Mordor said:
Elwro's solution is wrong.
My original reasoning was wrong; still, I think I'm on the right track with my last post.
Yes I think you are.

The discrete probabilities (of getting double heads in x flips) goes like:

0
0
25
12.5
12.5
9.375
then I don't know.
 

Marsal

Arcane
Joined
Oct 2, 2006
Messages
1,304
Okay, this is the last time I read this kind of topic. I just spent an hour scribbling on a piece of paper. I think I got it.

Imagine the dice have already been thrown n times (n is the answer to the OP). Keep in mind that some terminology may be off, because I don't know exact English terms for everything.

I counted all the combinations that are invalid (don't contain any two or more sixes in a row):

1. Just numbers 1 to 5 = 5^n
2. 1 six, all other 1 to 5 = n * 5^(n-1)
3. 2 sixes, not in a row, all other 1 to 5 = (n-1)(n-2)/2 * 5^(n-2)
3. 3 sixes, not in a row, all other 1 to 5 = (n-2)(n-3)(n-4)/6 * 5^(n-3)

...and so on ...

Let's write that in a sum:

SUM (r=0 to n/2) { (n-r+1)! / [ r! * (n-2r+1)! ] * 5^(n-r) }

r is number of sixes allowed. Why does it go to n/2? It actually goes to n/2 for even n and (n+1)/2 for odd n. You must have at least one "space" (number that is not 6) between 2 sixes (ie. for n=9, r=5: 6x6x6x6x6), so you can't have more than half +1 sixes and still not have two in a row.

The above SUM is the total number of combinations we don't want. There are 6^n possible combinations. So the result should be SUM / 6^n >= 1/2.

We feed this to Wolfram Alpha (the URL tag doesn't work or I'm doing it wrong, so just c/p the links):

http://www.wolframalpha.com/input/?i=SU ... 1%29!+%2F+[+r!+*+%28n-2r%2B1%29!+]+*+5^%28n-r%29+%29%2C+r%3D0+to+n%2F2

and then plot:

http://www.wolframalpha.com/input/?i=pl ... %29%2F2%29^x%2B%285%2F2%2B%283+sqrt%285%29%29%2F2%29^x%29%2F+6^x+*2+%3D1+from+x%3D20+to+35

And there you have it, little over 28.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom