On Wednesday, 27 March 2024 at 13:38:29 UTC, Salih Dincer wrote:

So, not works this:

```d
fib(1, 1).take(48)
         //.array
         .chunks(2)
         .map!"a[1] / a[0]"
         .back
         .writeln; // 1.61803
```

Thanks...

SDB@79

This works:

```d
import std.stdio;
import std.range;
import std.algorithm;

void main() {
auto fib = (real a, real b) => recurrence!"a[n-1] + a[n-2]"(a, b);
  auto golden = fib(1, 1).drop(46).take(2).fold!((a, e) => a/e);
  writefln("%.20f", golden);
  writeln("0.61803398874989484820");
}
```

Reply via email to