FIBS数列的差分测试

来源:互联网 发布:js定时弹出遮罩层 编辑:程序博客网 时间:2024/05/18 21:50

FIBS数列(defun pow (num count)(if (> count 0)      (* num (pow num (- count 1) ) )    1))(defun  expr (n)(if (eq  n 1)       1     (if  (eq  n  2)          1         (+  (expr  (-  n 1) )             (expr  (-  n 2) )))))(setq  A    (/ (sqrt  5)  5.0))(setq  B    (/ (sqrt  5)  5.0))(defun  formula (n)(+  (* A  (pow (/  (+  1  (sqrt 5) ) 2.0 ) n))    (* B  (pow (/  (-  1  (sqrt 5) ) 2.0 ) n))))(defun  test (n)(if (> n 0)  (progn        (print (formula n))       (print (expr n))       (test  (- n 1) ))  (print 'over)))(test  10)

原创粉丝点击