Skip to content

Instantly share code, notes, and snippets.

@menjaraz
Created September 28, 2024 17:49
Show Gist options
  • Save menjaraz/a8d8c0cb1e824354253a11b6367e530d to your computer and use it in GitHub Desktop.
Save menjaraz/a8d8c0cb1e824354253a11b6367e530d to your computer and use it in GitHub Desktop.
OEIS A014445 - Even Fibonacci numbers; or, Fibonacci(3*n).
/// 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