对方程的作用

时间:2013-12-16 22:09:08

标签: function recursion equation

鉴于函数的乐趣,Rec的数学方程是什么?

public class Fun {

  public static int Rec(int n) {

    if ((n==1) || (n==2))
      return 1;
    else {
      int result = 0;
      for(int i=2; i<=(n-1); i++)
        result = result+Rec(n-1)+ Rec(n-2);

      return result;
    }
  }
}   

1 个答案:

答案 0 :(得分:0)

f(0) = 0
f(1) = 1
f(2) = 1
f(3) = 2
f(4) = 6
f(5) = 24
f(6) = 120
f(7) = 720
f(8) = 5040
f(9) = 40320
f(10) = 362880
f(11) = 3628800

看起来像(n-1)!