Write a RECURSIVE method called “sequence” that takes a single int parameter (n) and returns the int value of the nth element of the sequenceS= 2, 4, 6, 12, 22, 40, 74, 136, 250, 460, …
Where S is defined by the recursive formula:
For n >= 0S(0) = 2; // Base case 1S(1) = 4; // Base case 2S(2) = 6; // Base case 3S(N) = 2 * ( S(N-1)/2 + S(N-2)/2 + S(N-3)/2)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here