Ejemplo n.º 1
0
 public void CountFibonacci()
 {
     for (int i = 1; i < this.Amount + 1; i++)
     {
         BigInteger a = BigInteger.Zero;
         BigInteger b = BigInteger.One;
         for (int j = 31; j >= 0; j--)
         {
             BigInteger d = a * (b * 2 - a);
             BigInteger e = a * a + b * b;
             a = d;
             b = e;
             if (((i >> j) & 1) != 0)
             {
                 BigInteger c = a + b;
                 a = b;
                 b = c;
             }
         }
         Fib.Add(a);
     }
 }