Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Re: Birthday Chances

by thraxil (Prior)
on Feb 15, 2002 at 15:38 UTC ( #145698=note: print w/replies, xml ) Need Help??

in reply to Re: Birthday Chances
in thread Birthday Chances

you're close on the math.

(ignoring leap-years) the probability that n people all have different birthdays is: ((365-1)/365) * ((365-2)/365) * ((365-3)/365) * . . . * ((365-n+1)/365) = 365! / ((365-n)! * 365^n)

setting that equal to 50% and solving is probably harder than just plugging in numbers on a calculator till you get it. 23 is the magic number.

anders pearson

Replies are listed 'Best First'.
Re: Re: Re: Birthday Chances
by ckohl1 (Hermit) on Feb 15, 2002 at 22:56 UTC

    To expand on what thraxil has said...

    This probability and permutations exercise could be written as:

    #!/usr/bin/perl -w use strict; my $DAYS_IN_YEAR = 365; print "\n# of People \t Birthday Match Likelihood\n" . '-'x80 . "\n"; for my $people ( 2 .. 40 ){ my $tmp_days = $DAYS_IN_YEAR; my $probability=1; for ( 1 .. $people ){ $probability *= $tmp_days--; } $probability /= $DAYS_IN_YEAR ** $people; $probability = ( 1 - $probability ) * 100; print "$people \t\t $probability %\n"; } exit;


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://145698]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2022-08-13 05:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found