Skip to content

Instantly share code, notes, and snippets.

@d1b
Created July 14, 2010 14:46
Show Gist options
  • Save d1b/475498 to your computer and use it in GitHub Desktop.
Save d1b/475498 to your computer and use it in GitHub Desktop.
import java.math.BigInteger;
public class hahaha
{
public static void main(String[] args)
{
BigInteger a = new BigInteger("0");
BigInteger b = new BigInteger("1");
float number = 1000000;
while(number-- > 1)
{
BigInteger temp = b;
b = b.add(a);
a = temp;
}
/* System.out.println(b.toString()); */
}
}
#!/usr/bin/env python
if __name__=="__main__":
a, b = 0, 1
for i in range(1000000):
a, b = b, a + b
#print a
#include <iostream>
#include <gmpxx.h>
using namespace std;
int main()
{
mpz_class a = 0;
mpz_class b = 1;
float number = 1000000;
while(number > 1)
{
number--;
mpz_class temp = b;
b += a;
a = temp;
}
/* cout << endl << b <<endl; */
return 0;
}
@d1b
Copy link
Author

d1b commented Jul 19, 2010

c++
time ./a.out

real 0m45.657s
user 0m44.711s
sys 0m0.056s

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