Home ChungLab Wiki
    • 설명
    • 못 고치는 문서
    • Menu
      • Navigation
      • RecentChanges
      • FindPage
      • 사이트맵
      • Help
      • HelpContents
      • HelpOnMoinWikiSyntax
      • 보기
      • 첨부
      • 정보
      • 원문 보기
      • 인쇄용 화면
      • 수정
      • 로드
      • 저장
    • 로그인

    Navigation

    • FindPage
    • HelpContents
    • FunReading
    2016-03-13 10:20:21에 수정된 1번째 판
    • FunReading
    • BirthdayParadox

    Birthday Paradox

    Birthday Paradox: 23명이 모이면 그 안에 생일이 같은 사람이 존재할 확률은 50% 이상.

    • 2014 FIFA 월드컵 본선 진출 32팀(각 팀 23명) 중 생일이 같은 멤버가 있던 팀은 16팀이었음 (BBC)

    • 참고자료

    계산해보자 (Python)

       1 person = 23
       2 odd = 1.0
       3 
       4 for x in range(2,person+1):
       5     odd = odd * (366 - x)/365
       6     print x, "person:", (1-odd)*100, "%"
    

    랜덤 생일 23개로 이루어진 그룹 10000개를 생성하고 그 중 같은 생일이 있는 그룹이 몇 개인지 헤아리는 시뮬레이션 Python Code

       1 import random
       2 
       3 class Birthday:
       4     def __init__(self, n=23):
       5         self.birthday = []
       6         for x in range(n):
       7             self.birthday.append(int(random.random()*365))
       8     def shared(self):
       9         seen = []
      10         for value in self.birthday:
      11             if value not in seen:
      12                 seen.append(value)
      13             else:
      14                 return True
      15         return False
      16 
      17 total = 10000
      18 shared = 0
      19 
      20 for x in range(total):
      21     birthday = Birthday()
      22     if birthday.shared():
      23         shared = shared +1
      24 
      25 print shared, "groups out of", total, "have members sharing the same birthday."
    
    Copyright © ChungLab. Built on MoinMoin and Bootstrap. All Rights Reserved.