All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
An enchanted coin (Posted on 2014-06-24) Difficulty: 3 of 5
You have a magic coin.
The first time you flip the coin it will land heads up.
The second time you flip the coin it will land tails up.
Every time you flip the coin after that, the probability that the coin will land heads up is proportional to the number of "heads up" that "run".

So for example, the probability of the third toss landing heads up is 1/2.
If the third toss is heads, then the probability of the fourth toss landing heads is 2/3, otherwise the probability of landing heads is only 1/3.
And so on.

Find the probability that the coin will land "heads up" exactly 42 times in the first 100 tosses (in a single run).

Source: NCH contest

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution possible solution | Comment 1 of 3
In 10,000 trials of the scenario, it looks as if the probability of each of the 99 possible numbers of heads is equal. That would be 1/99. Certainly the probability of exactly 42 heads would be the same as the probability of 42 tails or 58 heads.

number	     times
of heads    occurred
  1           99
  2      120
  3      104
  4      110
  5      120
  6      106
  7      99
  8      80
  9      95
 10      97
 11      97
 12      95
 13      110
 14      110
 15      106
 16      102
 17      92
 18      109
 19      85
 20      113
 21      108
 22      94
 23      96
 24      101
 25      110
 26      96
 27      89
 28      104
 29      97
 30      100
 31      99
 32      108
 33      85
 34      98
 35      78
 36      103
 37      86
 38      102
 39      103
 40      96
 41      116
 42      110
 43      87
 44      101
 45      96
 46      102
 47      100
 48      99
 49      105
 50      95
 51      116
 52      95
 53      108
 54      108
 55      97
 56      102
 57      101
 58      92
 59      84
 60      76
 61      114
 62      99
 63      85
 64      101
 65      95
 66      105
 67      101
 68      95
 69      104
 70      98
 71      119
 72      128
 73      139
 74      94
 75      107
 76      110
 77      89
 78      93
 79      94
 80      110
 81      106
 82      97
 83      112
 84      93
 85      113
 86      90
 87      105
 88      110
 89      92
 90      84
 91      108
 92      106
 93      131
 94      90
 95      96
 96      92
 97      102
 98      101
 99      100
  
A simple case is the probability of that first heads being the only one:

(1/2)*(2/3)*(3/4)*...*(98/99) = 1/99

For two heads it gets more complicated:

case 1, the second heads is on the third toss:
  H     T     T          T       T
(1/2)*(1/3)*(2/4)*...*(96/98)*(97/99) = 1/(98*99)
as the numerators go from 1 to 97 and the denominators from 2 to 99.
case 2, the second heads is on the fourth toss:
  T     H     T          T       T
(1/2)*(1/3)*(2/4)*...*(96/98)*(97/99) = 1/(98*99)
case 3, the second heads is on the fifth toss:
  T     T     H     T         T       T
(1/2)*(2/3)*(1/4)*(3/5)...*(96/98)*(97/99) = 1/(98*99
)  

These all have the same 1/(98*99) value and there are 98 of them, making the total of all cases 1/99.

I'd hate to go into this for each possible number of heads, but I suspect the answer would be the same: 1/99.

The simulation was done by:

DefDbl A-Z
Dim crlf$

Private Sub Form_Load()
 ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 DoEvents
  
 Dim score(100)
 For trial = 1 To 10000
   heads = 1: tosses = 2
   For toss = 3 To 100
     p = heads / tosses
     tosses = toss
     r = Rnd(1)
     If r <= p Then
       heads = heads + 1
     End If
   Next
   score(heads) = score(heads) + 1
   Text1.Text = Str(score(42)) & Str(trial)
   DoEvents
 Next trial
 Text1.Text = ""
 For i = 1 To 99
  Text1.Text = Text1.Text & Str(i) & Str(score(i)) & crlf
 Next

End Sub


  Posted by Charlie on 2014-06-24 15:23:52
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information