///
/// Permutation.
///
///
/// n n!
/// P = __________
/// r (n-r)!
///
/// n * (n-1) * (n-2) * (n-3) * ..... * (lower+1) * lower.
///
///
///
///
///
private long nPr(long upper,long lower)
{
long output = 1;
if(lower<1) lower = 1;
for(long i=upper;i>=lower;i--)
output *= i;
return output;
}
|