Created
April 11, 2015 03:27
-
-
Save RussellAndrewEdson/988ee2cc19e0543cc4dd to your computer and use it in GitHub Desktop.
The recursive G function from Godel, Escher, Bach.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn g | |
"The recursive G function from Godel, Escher, Bach: takes | |
in an integer n and returns G(n) = n - G(G(n-1)), with G(0) = 0." | |
[n] | |
(if (= n 0) | |
0 | |
(- n (g (g (- n 1)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment