Scientific Calculator
bthiessen/factorial2
By bthiessen
Double Factorial: Factorial function which only considers integers in the sequence of same parity (6!! = 6 x 4 x 2)
Tagged:
factorial2 = function(n) {
var x=1;
if (n == 2) -> x = 2;
if (n > 2) -> (
while (n > 1) -> (
x = x*n;
n -= 2;
);
);
x;
}
0 Comments
Sign in to leave a comment