package com.lovecoding.day08;

public class Test {
    public static void main(String[] args) {


        System.out.println(fn3(9));
        fn4(12);

    }
    public static int fn4(int n) {

        int count = 1;
        for (int i = n; i >=1  ; i--) {
            count = (count + 1) * 2;
            System.out.println(count);
        }
        return count;
    }
    public static int fn3(int n) {
        if (n == 10){
            return 1;
        }
        return (fn3(n+1)+1)*2;
    }

    public static int fn2(int n) {
        if(n<1){//负数是返回特殊值1，表示不计算负数情况
            return 1;
        }
        if(n==1 || n==2){
            return 1;
        }
        return fn2(n-2)+fn2(n-1);
    }

    public static int fn1(int n) {

        if(n<1){//负数是返回特殊值1，表示不计算负数情况
            return 1;
        }
        if(n==1 || n==2){
            return 1;
        }
        int beforebefore = 1;
        int before = 1;
        int now = before + beforebefore;

        for (int i = 4; i <= n; i++) {

            beforebefore = before;
            before = now;

            now =beforebefore+before;

        }

        return now;
    }
}
