this program finds fibonacci sequence starting at 1 then separate the 2 digit numbers so that it's not too big then factorial the numbers and add them. my problem is that its missing the final value in the sequence because the array is not big enough.

int sum = 1; int input; System.out.print("Enter a number: "); input = console.nextInt(); int[] fib = new int[input]; int[] out = new int[input]; int[] fib2 = new int[input]; fib[0] = 0; fib[1] = 1; fib2[0] = 0; fib2[1] = 1; if (input > 0) { if (input <= 7) { // for numbers 1,1,2,3,5,8 for (int i = 2; i < input; i++) { fib[i] = fib[i - 1] + fib[i - 2]; out[i] = factorial(fib[i]); } } else { // this is for the 2 digit numbers 13,21,34,55,89 for (int i = 2; i < input; i++) { fib[i] = fib[i - 1] + fib[i - 2]; fib2[i] = fib2[i - 1] + fib2[i - 2]; } for (int i = 2; i < input; i++) { fib[i] = separate(fib[i]); fib2[i] = separate2(fib2[i]); out[i] = factorial(fib[i]) + factorial(fib2[i]); } } for (int i : out) { sum = sum + i; } System.out.println(sum);

output is 40,490 but it should be 40,730 all is working except that if I input 10 it's missing the final value 55. computation is like this 1!+1!+2!+3!+5!+8!+1!+3!+2!+1!+3!+4!+5!+5! = 40,730