Common Birth Dates asked for the expected number of pairs of common birth dates for a cohort of 1000 people whose ages were clustered around a certain value.
Now consider a similar question to the traditional birthday problem: If you attend a concert or other event where people tend to be of a similar age, how large would such an event need to be in terms of number of attendees, so that you'd have at least a 50% probability that there would be at least two people born on the exact same day (year, month and day)?
Again to make things specific: assume the standard deviation about whatever the mean age to be is 12 years and it follows a normal distribution.
Again feel free to vary the assumptions about the distribution.
Soln:
I used mean 60 years and max age 120 (and sig 12).
I got 157 people. Each of 10 runs averaged 100,000 realizations.
In a second experiment, I lowered the mean age to 30, and the needed number diminished to 156. In this, the more youthful wing of the normal distribution was more deeply clipped at age 0, causing the age grouping to be more concentrated.
lord@rabbit 12478 % te
House = 156.888
House = 156.913
House = 156.807
House = 156.899
House = 156.827
House = 157.104
House = 157.203
House = 156.621
House = 157.066
House = 157.036
lord@rabbit 12478 % more te.f
program te
implicit none
integer i,j,k,kk,l,isum,norm,n(0:43825)
real*8 ave,mu,sigma
mu=60*365
sigma=12*365+3
do kk=1,10
isum=0
do 3 i = 1, 100000
do k=0,43825
n(k)=0
enddo
do j=1,1000
2 l = norm( mu, sigma )
if(l.lt.0.or.abs(l).gt.43825)then
c print*,'normal age exceeded ',l
go to 2
endif
if(n(l).eq.1)then
isum=isum+j
go to 3
else
n(l)=1
endif
enddo
print*,'Crowd exceeded 1000 people!'
call exit
3 enddo
ave = isum/1d5
print 4,ave
4 format('House = ',f8.3)
enddo
end
function norm( a, b )
c
c Standard Box-Muller
c
implicit none
real*8 a,b,r1,r2,pi,x
integer norm
pi = 4d0*atan(1.d0)
call random_number(r1)
call random_number (r2)
x = sqrt ( -2D0 * log ( r1 ) ) * cos ( 2D0 * pi * r2 )
norm = nint ( a + b * x )
return
end
Edited on November 18, 2021, 4:59 pm