You are viewing a single comment's thread. Return to all comments →
True.. check this out; string solve(long F) { double root5 = sqrt(5); double phi = (1 + root5) / 2; long nf = (long)(log(F*root5) / log(phi) + 0.5 ); long Fn = (long)( pow(phi, nf)/root5 + 0.5); if (Fn==F) return "IsFibo"; else return "IsNotFibo"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Is Fibo
You are viewing a single comment's thread. Return to all comments →
True.. check this out; string solve(long F) { double root5 = sqrt(5); double phi = (1 + root5) / 2; long nf = (long)(log(F*root5) / log(phi) + 0.5 ); long Fn = (long)( pow(phi, nf)/root5 + 0.5);
if (Fn==F) return "IsFibo"; else return "IsNotFibo"; }