Last active: 2 years ago
fn fibonacci(n: usize) -> Vec<usize> {
let mut f = (1, 1);
let mut fibo = vec![1, 1];
let calc = |_| {
f = (f.1, f.0 + f.1);
fibo.push(f.1);
};
if n > 2 {
(0..n - 2).for_each(calc);
}
fibo
}