Problem Description
A clueless student faced a pop quiz - a list of 24 Presidents of the 19th century and another list of
their terms of office, but scrambled. The object was t match the President with his term. He had
to guess every time. On average, how many terms would he guess correctly?
Create a program that simulates the quiz results by checking scores for a large number of random
matching trials.
Background & Techniques
This problem was published by Marilyn vos Savant in her "Ask Marilyn" column in Parade
magazine of July 25, 2004. I couldn't figure out how to solve
it analytically, so decided to resort to a simple program to generate test
data.
It should make an excellent Beginners
program, It took less than 40 lines of Delphi code to create
it. That included a loop that
generate sets of numbers, a procedure to shuffle them to randomize the lists, and
code to count how many are in the correct place and compute the
average. With enough code left over to use Delphi components
to:
- let the user select how
many samples are in each trial (TSpinEdit),
- whether to display some of the detailed
results (TCheckbox)
- and how many trials to run in each test
(TRadiogroup)..
Enjoy!
Running/Exploring the Program
Suggestions for Further Explorations
 |
There
is no doubt some analytical proof of the experimental results
obtained here - I just don't know where to find it. If you do,
please let me know, |
 |
Some
of the trial results have no correct matches. These are called
"derangements". It's an interesting fact that the
number of trial results that will be derangements approaches n!/e
(where e = the exponential constant, 2.718... )
as n gets larger. Since the number of permutations of n
things is n!, the fraction of outcome that will be
derangements will approach (n!/e)/n! = 1/e or about 37%
as n increases. See my Derangements
page for more info. |
| Original Date: July 27, 2004 |
Modified:
October 07, 2006
|
|