Towers of Hanoi

A friend of mine is starting a pretty fun looking math blog. His first post is on Towers of Hanoi. I'm sure he'll tackle it with some slick mathematics, but my usual M.O. is to convert everything to code. I remember this "Hello Recursive World" from SICP in Scheme; looks better in F#:

let rec hanoi f x t n =
  if n > 0
    hanoi f t x (n - 1
"From %c to %c"
f t
    hanoi x f t (n -

hanoi 'A' 'B' 'C' 8

Skip to main content