Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jiripospisil
Created November 11, 2013 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiripospisil/7413488 to your computer and use it in GitHub Desktop.
Save jiripospisil/7413488 to your computer and use it in GitHub Desktop.
Fibonacci numbers using gmp
#include <iostream>
#include <gmpxx.h>
int main(int argc, const char** argv)
{
mpz_class res;
mpz_fib_ui(res.get_mpz_t(), 20e6);
std::cout << res.get_str(10) << std::endl;
return 0;
}
@jiripospisil
Copy link
Author

clang++ -O2 kk.cc -lgmpxx -lgmp && time ./a.out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment