Post Reply 
(42S/DM42/Free42/Plus42) Birthday Probability Function
02-10-2023, 04:10 AM
Post: #1
(42S/DM42/Free42/Plus42) Birthday Probability Function
DM42, Free42, HP 42S: Birthday Probability Function

P = Π( 1 - m/C, m = 1 to N-1)

C = number of categories (examples: days in a calendar year, minutes in an hour, number of places, etc...)
N = sample population
P = probability that sample population does not share a category (examples: number of people that don't share the same birthday, number of people from a city that are not in the same location, etc...)


Code:
00 { 58-Byte Prgm }
01▸LBL "BDAY"
02 "CATEGORIES?"
03 PROMPT
04 STO 02
05 1
06 STO 01
07 "N?"
08 PROMPT
09 1
10 -
11 STO 03
12▸LBL 00
13 1
14 RCL 03
15 RCL÷ 02
16 -
17 STO× 01
18 DSE 03
19 GTO 00
20 "PROB= "
21 ARCL 01
22 AVIEW
23 RCL 01
24 .END.

Examples:

Probability that 40 people do not share a birthday (assume a 365 day calendar):
CATEGORIES? 365
N? 40

Probability: 0.10877

Probability that 3 cards drawn do not share the same suit:
CATEGORIES? 4 (4 suits in a deck of cards)
N? 3

Probability: 0.37500

Source:
Diaconis, Persi and Brian Skyrms Ten Great Ideas About Chance Princeton University Press: Princeton, New Jersey. 2018. ISBN 978-0-691-19639-8
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42S/DM42/Free42/Plus42) Birthday Probability Function - Eddie W. Shore - 02-10-2023 04:10 AM



User(s) browsing this thread: 1 Guest(s)