September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue