SHARE
TWEET

Untitled

a guest Jan 29th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void FibonacciGoldenNuggets()
  2.         {
  3.             BigInteger PolynomialApproximation(BigInteger p, BigInteger q)
  4.             {
  5.                 var pq = p * q;
  6.                 var denom = q * q - pq - p * p;
  7.  
  8.                 return (pq % denom != 0) ? -1 : pq / denom;
  9.             }
  10.             FibonacciNumbers()
  11.                 .Skip(2)
  12.                 .Where((x, i) => i % 2 == 0)
  13.                 .Zip(FibonacciNumbers().Skip(2).Where((x, i) => i % 2 == 1), (x, y) => (x, y))
  14.                 .Select(t => PolynomialApproximation(t.x, t.y))
  15.                 .DisplayStreamForce(stop: true);
  16.         }
  17.  
  18.         public static IEnumerable<BigInteger> FibonacciNumbers(int firstSeed = 0, int secondSeed = 1)
  19.         {
  20.             for (BigInteger first = firstSeed, second = secondSeed; ; first += second, second += first)
  21.             {
  22.                 yield return first;
  23.                 yield return second;
  24.             }
  25.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top