Created
September 28, 2024 17:49
-
-
Save menjaraz/a8d8c0cb1e824354253a11b6367e530d to your computer and use it in GitHub Desktop.
OEIS A014445 - Even Fibonacci numbers; or, Fibonacci(3*n).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// OEIS A014445 - Even Fibonacci numbers; or, Fibonacci(3*n). | |
/// https://oeis.org/A014445 | |
/// https://oeis.org/A014445/list | |
void main() => print(evenFibonacci().take(26)); | |
Iterable<int> evenFibonacci() sync* { | |
int a = 0, b = 2; | |
while (true) { | |
yield a; | |
int temp = a; | |
a = b; | |
b = temp + 4 * b; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment