SPUG: Stick Riddle
Geoffrey & Kristin Grosenbach
glyph at mac.com
Wed Jan 1 18:30:48 CST 2003
During a new year's party last night, a friend who is finishing a
master's degree in applied math gave me a riddle (of sorts).
THE PROBLEM:
Take a stick and randomly split it into three pieces. What is the
probability that the three pieces will be able to make a triangle?
(HINT: Three lengths make a triangle if the longest piece is shorter
than the sum of the other two).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\/
THE SOLUTION:
In his college course, he came up with the answer of 50% probability. I
wrote the attached Perl script to simulate this, and constently get 38%,
assuming the second split is done on the larger piece.
It appears that rand() is consistently random enough to give good
results, so that's not an issue. Should I tell him he's wrong (and use
Perl to prove it), or am I making an obvious error?
Geoff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stick.pl
Type: application/octet-stream
Size: 803 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20030101/b5d896a2/stick.obj
More information about the spug-list
mailing list