(defun fib-helper (a b p q n)
(cond ((zerop n) b)
((oddp n) (let ((aq (times a q)))
(fib-helper (plus (times b q) aq (times a p))
(plus (times b p) aq)
p
q
(sub1 n))))
(t (let ((qq (times q q)))
(fib-helper a
b
(plus (times p p) qq)
(plus qq (times 2 p q))
(quotient n 2))))))