in reply to New Jersey Lottery Probability

> 50 * 49 * 48 * 47 * 46 * 36 = $probability; That's not the likelihood of choosing the right 6; it's the likelihood of choosing the right 6 _in a particular order_. -- Malcolm

Replies are listed 'Best First'.
RE: RE: New Jersey Lottery Probability
by nuance (Hermit) on May 05, 2000 at 17:22 UTC
    You are of course correct it's calculating permutations not combinations, the following sorts that out. No I'm not going to do all obfuscation stuff on it :-0

    #!/usr/bin/perl -w use strict; my ($number, $times) = (50, 5); print &permutation($number, $times) * 36 / ($times + 1); sub permutation { my ($prob, $number, $times) = (1, @_); while($times) { $prob *= ($number - $times + 1) / $times--; }; $prob; };