September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -6,9 +6,9 @@ fn main() {
}
}
fn fibonacci_gen(terms: i32) -> impl Iterator<Item=f64> {
fn fibonacci_gen(terms: i32) -> impl Iterator<Item=u64> {
let sqrt_5 = 5.0f64.sqrt();
let p = (1.0 +sqrt_5) / 2.0;
let p = (1.0 + sqrt_5) / 2.0;
let q = 1.0/p;
(1..terms).map(move |n| ((p.powi(n) + q.powi(n)) / sqrt_5 + 0.5).floor())
(1..terms).map(move |n| ((p.powi(n) + q.powi(n)) / sqrt_5 + 0.5) as u64)
}