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

Home > Probability
Coin tossing (Posted on 2004-06-11) Difficulty: 3 of 5
I threw a coin n times, and never got three tails in a row. I calculated the odds of this event, and found out they were just about even; 50%-50%. How many times did I throw the coin?

A second question: what were the chances of having not gotten three heads in a row either?

See The Solution Submitted by Federico Kereki    
Rating: 3.6667 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: Exhaustion--1st and 2nd questions--the program | Comment 15 of 25 |
(In reply to Exhaustion--1st and 2nd questions by Charlie)

The program which produced the exhaustive list of H-T sequences and counted results is:

DECLARE SUB toss ()
OPEN "ctoss.txt" FOR OUTPUT AS #2
DIM SHARED s$, Tctr, Hctr, Bctr, Nctr
  toss
PRINT #2, : PRINT #2, "TTT"; Tctr; "; HHH"; Hctr; "; both"; Bctr; "; neither"; Nctr
CLOSE
END

SUB toss
 IF LEN(s$) = 10 THEN
   PRINT #2, s$; " ";
   ix1 = INSTR(s$, "TTT")
   ix2 = INSTR(s$, "HHH")
   IF ix1 THEN PRINT #2, "TTT "; : Tctr = Tctr + 1
   IF ix2 THEN PRINT #2, "HHH "; : Hctr = Hctr + 1
   IF ix1 > 0 AND ix2 > 0 THEN Bctr = Bctr + 1
   IF ix1 = 0 AND ix2 = 0 THEN Nctr = Nctr + 1
   PRINT #2,
 ELSE
     s$ = s$ + "H"
     toss
     s$ = LEFT$(s$, LEN(s$) - 1) + "T"
     toss
     s$ = LEFT$(s$, LEN(s$) - 1)
 END IF
END SUB

 


  Posted by Charlie on 2004-06-13 11:53:37
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 (2)
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