/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package fibonacci; /** * * @author suchenek */ public class FibbonaciHW { static int count = 0; public static void main (String [] args) { int lim = 1024; for (int n = 1; n <= lim; n++) { count = 0; int m = F(n); System.out.print("F(" + n + ") = " + m); System.out.println(" count = " + count); } } public static int F(int n) { count++; if (n == 0) return 1; if (n%10 == 0) return (F(n/2) + F(n/5)); else if (n%6 == 0) return(F(n/2) + F(n/3)); else return(F(n/3) + F(n/5)); } }