From 114d2e42c53e0a4a938e68fea81c35abae666232 Mon Sep 17 00:00:00 2001 From: martincostello Date: Wed, 14 Feb 2024 14:59:41 +0000 Subject: [PATCH] Use Index() Use the new `Index()` method. --- src/ProjectEuler/Puzzles/Puzzle025.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ProjectEuler/Puzzles/Puzzle025.cs b/src/ProjectEuler/Puzzles/Puzzle025.cs index 02a0bd16..052bc57d 100644 --- a/src/ProjectEuler/Puzzles/Puzzle025.cs +++ b/src/ProjectEuler/Puzzles/Puzzle025.cs @@ -45,15 +45,11 @@ internal static IEnumerable Fibonacci() /// protected override int SolveCore(string[] args) { - int index = 0; - - foreach (BigInteger value in Fibonacci()) + foreach ((int index, BigInteger value) in Fibonacci().Index()) { - index++; - if (value >= Limit) { - Answer = index; + Answer = index + 1; break; } }