18/07/02 18:08:42.13 MkmxQ31H.net
>>445
シミュレーションプログラム
date=1:366
Y=365.2425
p=c(97/400,rep(1,365)) # leap year
man.day<-function(n,k=1e3){
work <- function(n){
x=sample(date,n,replace=TRUE,prob=p)
(Y-length(unique(x)))*n
}
mean(replicate(k,work(n)))
}
vmd=Vectorize(man.day)
x=360:370
y=vmd(x,1e5)
x[which.max(y)]
plot(x,y,type='h')