# cookbook

## Farey-Cauchy sequence in Lisp

A short and simple algorithm in Common Lisp for the Farey-Cauchy sequence. Among other things (reformulating the Riemann hypothesis, etc), it helps with the "Ford's touching circles" problem.

```
``` (defun farey-cauchy (n)

(let ((a 0) (b 1) (c 1) (d n) k f e)

(format t "~a/~a " a b)

(loop while (< c n) do

(setq k (floor (/ (+ n b) d))

e (- (* k c) a)

f (- (* k d) b)

a c

b d

c e

d f)

(format t "~a/~a " a b))))

CL-USER> (farey-cauchy 7)

```
```

```
```##
The Ackermann Function in LISP

The Ackermann function is a killer: It looks very simple, yet it plays a major

role in computer science and computational complexity theory. This is its

definition.

(Source and copyright: kosara.net/thoughts/ackermann.html)

```
```