Laplace´s Birthday-Matching Problem
- From: "\"Luis A. Afonso\"" <licas_@xxxxxxxxxxx>
- Date: Wed, 24 May 2006 05:45:56 EDT
This classic problem was solved by the French Scientist Pierre - Simon Laplace (1749-1827).
Nowadays this problem, as stated by Laplace, has no more interest, except pedagogically, as I show through different posts concerning its generalizations.
In spite was I said I would like to present a routine of mine in this matter.
Example (random)
For 4 persons the probability:
p(all birthdays different) = 9.83644087533 D-001
p(at least one matching) = 1.63559124666 D-002
or 0.98364 , 0.01636 rounded to five decimal places.
_____licas (Luis A. Afonso)
REM "ABIRTH"
CLS
DEFDBL A-Z
DEF fng (j) = 1 - j / 365
120 INPUT " How many people "; w
IF w < 0 OR INT(w) <> w THEN GOTO 10
IF w > 365 THEN GOTO 12
IF w < 2 THEN GOTO 10
GOTO 20
10 CLS : GOTO 120
20 a = 1 - 1 / 365: p = 1
FOR j = 1 TO w - 1
p = p * fng(j)
NEXT j
12 PRINT " ALL BIRTHDAYS DIFFERENT "
PRINT USING "##.###########^^^^^"; p
PRINT " AT LEAT ONE BIRTHMATCHING "
PRINT USING "##.###########^^^^^"; 1 - p
END
.
- Follow-Ups:
- Re: Laplace´s Birthday-Matching Problem
- From: \"Luis A. Afonso\"
- Re: Laplace´s Birthday-Matching Problem
- From: \"Luis A. Afonso\"
- Re: Laplace´s Birthday-Matching Problem
- From: yurra
- Re: Laplace´s Birthday-Matching Problem
- Prev by Date: Re: skewness in residuals after log transform. Now what?
- Next by Date: Who needs to evaluate this *stuff*?
- Previous by thread: model fitting with varying number of 'voters'
- Next by thread: Re: Laplace´s Birthday-Matching Problem
- Index(es):