$c=.500 365?.@$365
$D=. i.&0"1(=&#~.)\"1 c
mean D+1  NB. 25.086
pretty 5 SL sortleaf 1+D

$c=. 10 500 365?.@$365
$D=. i.&0"1(=&#~.)\"1 c
mean, D+1. NB. 24.6856
pretty"2] 5 SL"0 1 sortleaf"1] 1+D

I am suspicious of these results because my memory is that the mean is closer 
to 18.5 people. Then again, other measures of the center look closer to 19, 
just looking at the stemplots.

---
(B=)

On Jan 15, 2012, at 5:40 AM, "Linda Alvord" <lindaalv...@verizon.net> wrote:

> 
> For this challenge, as usual,  do not use  @  but you may use whatever style
> and strategy you like to accomplish the task.
> 
> 
> 
> The problem is to simulate the classic birthday problem.
> 
> 
> 
> A single trial works this way.  People enter a room one by one and declare
> their birth date.  Suppose the 29th person is the first person to match a
> birthday of someone in the room.  The result of the first trial is 29.
> 
> 
> 
> Repeat for 500 trials.
> 
> 
> 
> If you use Kip's frequency distribution of the results you have lots of
> information.
> 
> 
> 
>  fd=:[: /:~ ~. ,. [: +/"1 ~. =/ ]
> 
> 
> 
> But the mean gives a more concise summary of the data.  So, the final part
> of the problem is to obtain a list of  10  means of  500  trials and the
> mean of the means.
> 
> 
> 
> Linda
> 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to