Rewrite COLLATZ to close over its variable