Factorial: Difference between revisions

m (→‎Iterative: Common bug in R: 2:1 is c(2, 1) and not the empty list.)
Line 6,551:
 
fn factorial_iterative(n: u64) -> u64 {
(1..=n+1).foldproduct(1, |p, n| p*n)
}
 
Anonymous user