2 ms·
I tried this in Common Lisp: (defun tetrate (a n) (if (= n 0) 1 (expt a (tetrate a (1- n))))) (compile 'tetrate) (time (integer-length (tetrate
by ScottBurson 8y ago
I tried this in Common Lisp:
(defun tetrate (a n)
(if (= n 0) 1
(expt a (tetrate a (1- n)))))
(compile 'tetrate)
(time (integer-length (tetrate 7 3))
I used 'integer-length' to check that a number of the correct magnitude was produced without actually having 700kB of digits dumped into my REPL buffer. On a new MacBook Pro running SBCL, this took, ah, 624 milliseconds. So there's some room for optimization of the JavaScript implementation :-)