Help for this page

Select Code to Download


  1. or download this
    sub permutation {
        my ($prob, $start) = (1, shift);
        $prob *= $start-- foreach (1 .. $_[0]);
        $prob;
    }
    
  2. or download this
    sub permutation {
        my $prob = 1;
        $prob *= $_ foreach ((($_[0]+1) - $_[1]) .. $_[0]);
        return $prob;
    }
    
  3. or download this
    sub permutation {
        my $prob = 1;
        return (map { $prob *= $_ } (($_[0] - $_[1] + 1) .. $_[0]))[-1];
    }