As a third option, if you'd like to have the relevant CS terminology, see Matt Might's derivation, also in JavaScript, at http://matt.might.net/articles/implementation-of-recursive-f....