18 lines
902 B
C#
18 lines
902 B
C#
private static int[] fibs = new int[]{ -1836311903, 1134903170,
|
|
-701408733, 433494437, -267914296, 165580141, -102334155,
|
|
63245986, -39088169, 24157817, -14930352, 9227465, -5702887,
|
|
3524578, -2178309, 1346269, -832040, 514229, -317811, 196418,
|
|
-121393, 75025, -46368, 28657, -17711, 10946, -6765, 4181,
|
|
-2584, 1597, -987, 610, -377, 233, -144, 89, -55, 34, -21, 13,
|
|
-8, 5, -3, 2, -1, 1, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,
|
|
144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711,
|
|
28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040,
|
|
1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817,
|
|
39088169, 63245986, 102334155, 165580141, 267914296, 433494437,
|
|
701408733, 1134903170, 1836311903};
|
|
|
|
public static int Fib(int n) {
|
|
if(n < -46 || n > 46) throw new ArgumentOutOfRangeException("n", n, "Has to be between -46 and 47.")
|
|
return fibs[n+46];
|
|
}
|