Skip to content

Instantly share code, notes, and snippets.

@RussellAndrewEdson
Last active August 29, 2015 14:18
Show Gist options
  • Save RussellAndrewEdson/7d8dc2217abe2179ecb1 to your computer and use it in GitHub Desktop.
Save RussellAndrewEdson/7d8dc2217abe2179ecb1 to your computer and use it in GitHub Desktop.
The recursive H function from Godel, Escher, Bach.
(defn h
"The recursive H function from Godel, Escher, Bach: takes
in an integer n and returns H(n) = n - H(H(H(n-1))), with H(0) = 0."
[n]
(if (= n 0)
0
(- n (h (h (h (- n 1)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment