You are viewing a single comment's thread. Return to all comments →
I used Binet's Formula. Only got 3/4 test case.
public static void getFibs(int digit) { if(digit == 1) { Console.WriteLine(1); } else { double phi = 1.61803; double approx = Math.Pow(10,digit-1); double sqrtFive = Math.Sqrt(5); double ans = 0; int nth = 0; for(int i = 1; ans < approx; i++) { ans = Math.Pow(phi,i) / sqrtFive; nth = i; } Console.WriteLine(nth); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #25: N-digit Fibonacci number
You are viewing a single comment's thread. Return to all comments →
I used Binet's Formula. Only got 3/4 test case.