## Poll

 I love math! 20 votes (46.51%) Math is great. 14 votes (32.55%) My religion is mathology. 6 votes (13.95%) Women didn't speak to me until I was 30. 2 votes (4.65%) Total eclipse reminder -- 04/08/2024 12 votes (27.9%) I steal cutlery from restaurants. 3 votes (6.97%) I should just say what's on my mind. 6 votes (13.95%) Who makes up these awful names for pandas? 5 votes (11.62%) I like to touch my face. 12 votes (27.9%) Pork chops and apple sauce. 9 votes (20.93%)

43 members have voted

Wizard Joined: Oct 14, 2009
• 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

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 Joined: Oct 2, 2017
• 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 Joined: Jun 22, 2011
• 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 Joined: Oct 14, 2009
• 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.

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 Joined: Oct 2, 2017
• 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 Joined: Oct 2, 2017
• 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 Joined: Oct 14, 2009
• 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 ?

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 Joined: Oct 2, 2017
• 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 ?

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.

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 Joined: Jun 22, 2011
• Posts: 5680
Thanks for this post from: 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.

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.

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 Joined: Oct 2, 2017  