Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Fibonacci-sequence/ACL2/fibonacci-sequence.acl2
Normal file
17
Task/Fibonacci-sequence/ACL2/fibonacci-sequence.acl2
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(defun fast-fib-r (n a b)
|
||||
(if (or (zp n) (zp (1- n)))
|
||||
b
|
||||
(fast-fib-r (1- n) b (+ a b))))
|
||||
|
||||
(defun fast-fib (n)
|
||||
(fast-fib-r n 1 1))
|
||||
|
||||
(defun first-fibs-r (n i)
|
||||
(declare (xargs :measure (nfix (- n i))))
|
||||
(if (zp (- n i))
|
||||
nil
|
||||
(cons (fast-fib i)
|
||||
(first-fibs-r n (1+ i)))))
|
||||
|
||||
(defun first-fibs (n)
|
||||
(first-fibs-r n 0))
|
||||
Loading…
Add table
Add a link
Reference in a new issue