Instructions For this assignment, you been assigned a group number. Depending on the group number you are to write the recursive code that generates the sequence for your group number. For example, if you are in Group 3 your code will generate the following sequence:

Instructions

For this assignment, you been assigned a group number. Depending on the group number you are to write the recursive code that generates the sequence for your group number. For example, if you are in Group 3 your code will generate the following sequence:

———————————————

1, 1, 2, 1, 12, -44, 297, -1689, 10007, -58684, 345017, -2027154, 11912452, -70000099, 411339437, 1877831777, 1318811834, -1860305915, 833755688, -146620168

In addition, you will output the recursive call multipliers x, y, z values under your sequence output.

Note x,y,z are integers that can range in values from : -10 to 10

This assignment can easier be done if you know Linear Algebra. If you use you must show your work, by attaching the pdf of the work in you netbeans project src folder.

If you do not know Linear Algebra you must crack the sequence my brute force….

Hint: Use the idea of Fibonacci recursive code in the notes with one more lag call.

Multiplier: x, y, z

————————————–

X -> is the multiplier of the recursive call of the (n-1) term

Y -> is the multiplier of the recursive call of the (n-2) term

Z -> is the multiplier of the recursive call of the (n-3) term

My Code

package recursion;

/**

*

* @author rgarc

*/

public class Recursion {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

int[] goodNumbers = {1, 1, 2, 1, 12,

-44, 297, -1689, 10007, -58684,

345017, -2027154, 11912452, -70000099, 411339437,

1877831777, 1318811834, -1860305915, 833755688, -146620168

};

int[] emptyNumbers = new int[20];

for (int x = -10; x <= 10; x++) {

for (int y = -10; y <= 10; y++) {

for (int z = 10; z <= 10; z++) {

for (int n = 0; n < 20; n++) {

int currentValue = fib(n, x, y, z);

if (currentValue == goodNumbers[n – 1]) {

emptyNumbers[n – 1] = currentValue;

}

}

}

}

}

for (int i = 0; i < emptyNumbers.length; i++) {

System.out.println(emptyNumbers[i] + ” ,”);

}

}

public static int fib (int n, int x, int y, int z ){

if ( n == 1){

 

}

if ( n == 2){

return 1;

}

if ( n == 3){

return 2;

}

return ( x * fib(n-3, x,y,z)) + ( y * fib (n-2, x,y,z)) + (z * fib (n-1, x,y,z));

}

}

GET HELP WITH YOUR HOMEWORK PAPERS @ 25% OFF

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

Write My Paper Button

WeCreativez WhatsApp Support
We are here to answer your questions. Ask us anything!
👋 Hi, how can I help?
Scroll to Top