The other day the topic of the binomial distribution came up. The binomial distribution is a part of probability theory and looks like this:
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1
I thought writing a sub to generate this would be easy.....
So here is another hole. Rules:
(1) sub accepts one arg which corresponds to the number of levels to print;
(2) sub prints it out
(3) formating like this is OK
1 1 1 1 2 1 1 3 3 1 <- this is level 4 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1 1 10 45 120 210 252 210 120 45 10 1
(4) how about we use strict, just for something different
I have <70 chars, can you do better? I'll post mine in 2 days
tachyon
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Binomial Golf
by japhy (Canon) on May 30, 2001 at 08:32 UTC | |
by chipmunk (Parson) on May 30, 2001 at 18:19 UTC | |
Re: Binomial Golf
by gumpu (Friar) on May 30, 2001 at 11:16 UTC | |
by Arguile (Hermit) on May 30, 2001 at 15:23 UTC | |
by gumpu (Friar) on May 30, 2001 at 15:50 UTC | |
Re: Binomial Golf
by MeowChow (Vicar) on May 31, 2001 at 00:38 UTC | |
Re: Binomial Golf
by Arguile (Hermit) on May 30, 2001 at 14:37 UTC | |
Re: Binomial Golf
by tachyon (Chancellor) on May 31, 2001 at 06:00 UTC |
Back to
Meditations