It's been a week, so here's my solution that recurses on `n` once at the term level: https://gist.github.com/effectfully/790fe6549a0ccc519bda4b9680b63b67 Hope it was a funny little puzzle.