Refactored is_fibo's solution to remove side effects from the method. No global variables.