Thread Rating:

Poll

20 votes (46.51%)
14 votes (32.55%)
6 votes (13.95%)
2 votes (4.65%)
12 votes (27.9%)
3 votes (6.97%)
6 votes (13.95%)
5 votes (11.62%)
12 votes (27.9%)
9 votes (20.93%)

43 members have voted

Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1454
  • Posts: 25287
February 3rd, 2022 at 6:02:20 PM permalink
Quote: Ace2

Avg rolls to get two consecutive 7s is: 6^1 + 6^2 = 42
link to original post



Interesting. It leads me to a another puzzle...

What is the expected number of flips of a coin to get two consecutive heads? What if the probability of heads is p? Please don't just reference Ace2's answer as something "previously solved."
“Extraordinary claims require extraordinary evidence.” -- Carl Sagan
Ace2
Ace2
Joined: Oct 2, 2017
  • Threads: 31
  • Posts: 2318
February 3rd, 2022 at 6:11:57 PM permalink
For an event with probability p, the expected number of trials to get c consecutive occurrences of the event is the sum of (1/p)^n from n= 1 to c.

It’s all about making that GTA
ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 114
  • Posts: 5680
February 3rd, 2022 at 6:13:05 PM permalink
Quote: Wizard

Interesting. It leads me to a another puzzle...

What is the expected number of flips of a coin to get two consecutive heads? What if the probability of heads is p? Please don't just reference Ace2's answer as something "previously solved."



Let E(n) be the expected number of tosses needed to get to 2 consecutive heads from n consecutive heads
E(2) = 0
E(1) = 1 + p E(2) + (1 - p) E(0) = 1 + (1 - p) E(0)
E(0) = 1 + p E(1) + (1 - p) E(0)
p E(0) = 1 + p E(1)
E(0) = 1/p + E(1) = 1/p + 1 + (1 - p) E(0)
p E(0) = (p + 1) / p
E(0) = (p + 1) / p^2 = 1/p + (1/p)^2

For p = 1/2, the expected number is 1 / (1/2) + (1 / (1/2))^2 = 2 + 4 = 6.

Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1454
  • Posts: 25287
February 3rd, 2022 at 6:13:53 PM permalink
Quote: Ace2

For an event with probability p, the expected number of trials to get c consecutive occurrences of the event is the sum of (1/p)^n from n= 1 to c.

link to original post



I don't dispute this is true. In fact, I can see it is true for n = 1 and n = 2. However, for full credit, you have to prove it.
“Extraordinary claims require extraordinary evidence.” -- Carl Sagan
Ace2
Ace2
Joined: Oct 2, 2017
  • Threads: 31
  • Posts: 2318
February 3rd, 2022 at 6:23:35 PM permalink
For an event with probability p, the expected number of trials to get c consecutive occurrences of the event can also be expressed as : ((1/p)^(c+1) -1) / (1/p - 1) -1

So, for instance, to roll three consecutive 7s with a pair of dice the avg number rolls is: (6^4 -1) / 5 - 1 = 258

The formula is reduced for a 50/50 coin flip. To get, for example, seven consecutive heads the avg number of flips is simply 2^8 -2 = 254

Last edited by: Ace2 on Feb 3, 2022
It’s all about making that GTA
Ace2
Ace2
Joined: Oct 2, 2017
  • Threads: 31
  • Posts: 2318
February 3rd, 2022 at 6:52:49 PM permalink
Going along with the current theme of this thread, how many rolls would it take, on average, to roll 18 consecutive yo’s ?
It’s all about making that GTA
Wizard
Administrator
Wizard
Joined: Oct 14, 2009
  • Threads: 1454
  • Posts: 25287
February 3rd, 2022 at 7:01:20 PM permalink
Quote: Ace2

Going along with the current theme of this thread, how many rolls would it take, on average, to roll 18 consecutive yo’s ?
link to original post



Good one!

I get 41,660,902,667,961,000,000,000 (please forgive the Excel limit for significant digits)

Assuming one roll per second per person (24/7) and a global population of 8 billion, it would take, on average, 165,019 years to see this happen.
Last edited by: Wizard on Feb 11, 2022
“Extraordinary claims require extraordinary evidence.” -- Carl Sagan
Ace2
Ace2
Joined: Oct 2, 2017
  • Threads: 31
  • Posts: 2318
February 3rd, 2022 at 7:09:51 PM permalink
Quote: Wizard

Quote: Ace2

Going along with the current theme of this thread, how many rolls would it take, on average, to roll 18 consecutive yo’s ?
link to original post



Good one!

I get 41,660,902,667,961,000,000,000 (please for the Excel limit for significant digits)

Assuming one roll per second per person (24/7) and a global population of 8 billion, it would take, on average, 165,019 years to see this happen.
link to original post

Agreed.

(18^19 -1) / 17 - 1 =- 4.17 x 10^22 rolls

In this case you could just call it 18^19 / 17.

Those two “minus 1s” don’t have much of a relative effect on a 23 digit answer!
It’s all about making that GTA
ThatDonGuy
ThatDonGuy
Joined: Jun 22, 2011
  • Threads: 114
  • Posts: 5680
Thanks for this post from:
aceside
February 3rd, 2022 at 7:41:19 PM permalink
Quote: Wizard

Quote: Ace2

For an event with probability p, the expected number of trials to get c consecutive occurrences of the event is the sum of (1/p)^n from n= 1 to c.

link to original post



I don't dispute this is true. In fact, I can see it is true for n = 1 and n = 2. However, for full credit, you have to prove it.
link to original post



Let E(k) be the number of trials needed to get c consecutive occurrences given k consecutive occurrences

E(c) = 0
E(c-1) = 1 + (1 - p) E(0)
E(c-2) = 1 + p E(c-1) + (1 - p) E(0)
= 1 + p (1 + (1 - p) E(0)) + (1 - p) E(0)
= 1 + p + p (1 - p) E(0) + (1 - p) E(0)
= (1 + p) + (p + 1)(1 - p) E(0)
= (1 + p) + (1 - p^2) E(0)
E(c-3) = 1 + p E(c-2) + (1 - p) E(0)
= 1 + p ((1 + p) + (1 - p^2) E(0)) + (1 - p) E(0)
= 1 + p + p^2 + (p - p^3) E(0) + (1 - p) E(0)
= 1 + p + p^2 + (1 - p^3) E(0)
...
E(c-k) = 1 + p + p^2 + ... + p^(k-1) + (1 - p^k) E(0)
...
E(1) = (1 + p + p^2 + ... + p^(c-2)) + (1 - p^(c-1)) E(0)
E(0) = 1 + p E(1) + (1 - p) E(0)
= 1 + p (1 + p + p^2 + ... + p^(c-2)) + E(0) (p - p^c + 1 - p)
= 1 + p (1 + p + p^2 + ... + p^(c-2)) + E(0) (1 - p^c)
p^c E(0) = 1 + p (1 + p + p^2 + ... + p^(c-2))
= 1 + p + p^2 + ... + p^(c - 1)
= (1 - p^c) / (1 - p)
E(0) = (1 - p^c) / (p^c (1 - p))
= ((1 - p^c) / (1 - p)) / p^c
= (p^(c-1) + p^(c-2) + ... + 1) / p^c
= 1/p + 1/p^2 + ... + 1/p^c

Ace2
Ace2
Joined: Oct 2, 2017
  • Threads: 31
  • Posts: 2318
Thanks for this post from:
acesideteliot
February 4th, 2022 at 11:22:57 AM permalink
For a 50/50 coin flip, Fibonacci can also be used for the calculation

The expected number of flips to get c consecutive heads is the c+3 number of the Fibonacci series of order c, plus 1

So, for example, the expected number of flips to get six consecutive heads is the 9th “Hexanacci” number (125) plus 1 is 126.
It’s all about making that GTA

  • Jump to: