I tried to solve Project Euler problem #2 using Recurrence/recurrence.
Assuming genEvenFibonacci
is the appropriate funtion in Explicit form, I got what I need like so:
auto evenfib = recurrence!genEvenFibonacci(2uL, 8uL);
writeln;
evenfib.take(11).sum.writeln;
But that's like cheating because there is no prior knowledge of 11
.
I just got it manually by peeking at the sequence [2, 8, 34, 144, 610, 2584, 10946, 46368, 196418, 832040, 3524578, 14930352]
.
14930352
must be filtered out because beyond the limit set!
How to fix that properly using all the standard library capabilities programatically?
I'm thinking of Range and/or std.algorithm.