public static string Solve() { int length = 100; string A = "1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"; string B = "8214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196"; string[] strs = new string[] { B, A }; List <long> fib = EulerUtilities.Fibonacci(Generator(17)); string result = ""; for (int i = 0; i <= 17; i++) { long index = Generator(i); long target = (index - 1) / length; int f = FirstAbove(target, fib) + 2; int a = (int)AorB(fib[f] - target); result = StringAccess(strs[a], (int)(index % length - 1)) + result; } return(result); }
public static bool IsFibonacciPossible(int k, int n) { List <int> fibonacci = EulerUtilities.Fibonacci(k); return(IsFibonacciPossible(k, n, 0, fibonacci, fibonacci.Count - 1)); }