home *** CD-ROM | disk | FTP | other *** search
- 0 rem << rr20-2 >>
- 1 rem
- 2 rem -- birthday calc --
- 3 rem rupert report #20
- 4 rem
- 10 rem - calculate the probability
- 11 rem that for a group of np people
- 12 rem two or more of them were born
- 13 rem on the same day of the year
- 14 rem
- 20 print chr$(147):poke53280,7:poke53281,9:poke646,7
- 30 print "how many people are in the room":print"(enter 0 for complete list)"
- 40 input np
- 50 if np<=0 or int(np)<>np then 200
- 60 pf=1 :rem probability of failure
- 70 for q=1 to np
- 80 pf=(367-q)*pf/366 : next
- 90 ps=1-pf :rem probability of success
- 100 print
- 110 print"in a group of" np "people,"
- 120 print"there is a" ps*100 "percent"
- 130 print"probability that two or more"
- 140 print"people have the same birthday"
- 150 print
- 160 goto 30
- 200 pf=1
- 210 for np=1 to 366
- 220 pf=pf*(367-np)/366
- 230 print "# people ="np;
- 240 print " % prob. =" (1-pf)*100
- 245 rem count # of lines listed (nl)
- 250 nl=nl+1 : if nl<20 then 290
- 260 nl=0
- 270 print "press any key for more..."
- 280 get x$:if x$="" then 280
- 290 next
-