Problem 46 in Lisp