Split main logic into a separate function.
Fibonacci functor.
Const correctness.
Use while loop for clarity.