Skip to content

Instantly share code, notes, and snippets.

@darkseed
Created August 5, 2011 14:31
Show Gist options
  • Save darkseed/1127659 to your computer and use it in GitHub Desktop.
Save darkseed/1127659 to your computer and use it in GitHub Desktop.
Fibonacci
int Fibonacci(int k)
{
double phi = 0.5*(1.0 + sqrt(5.0));
return int( pow(phi, k)/sqrt(5.0) + 0.5 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment