This is my source code:
public class Fibbonaci {
static int count;
static int size;
public static int Fibbonaci(int n) {
count++;
if (n == 0) {
return 1;
}
if (n % 10 == 0) {
return (Fibbonaci(n / 2) + Fibbonaci(n / 5));
} else if (n % 6 == 0) {
return (Fibbonaci(n / 2) + Fibbonaci(n / 3));
} else {
return (Fibbonaci(n / 3) + Fibbonaci(n / 5));
}
}
public static void main(String[] args) {
int[] lim = new int[1024];
for (int n = 1; n <= lim.length - 1; n++) {
count = 0;
Fibbonaci(n);
size = (int) Math.floor(Math.log(n) / Math.log(2)) + 1;
System.out.print("T(" + size + ") = ");
System.out.println("" + count);
}
}
}
Some of my current output is this:
T(1) = 3
T(2) = 3
T(2) = 5
T(3) = 5
T(3) = 7
T(3) = 9
T(3) = 7
T(4) = 7
T(4) = 9
T(4) = 11
T(4) = 9
T(4) = 15
How can i print the max value for the size and count where i can get an output of similar to T(1) = 3 T(2) = 5 T(3) = 9 T(4) = 15?