From 6d5e19b49f0b99b704b519230430fa2306dcad7d Mon Sep 17 00:00:00 2001 From: Myoungjin JEON Date: Sun, 8 Nov 2020 17:18:05 +1100 Subject: [ch-085/jeongoon] ch-2.lsp: removed unnececsary code --- challenge-085/jeongoon/common-lisp/ch-2.lsp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/challenge-085/jeongoon/common-lisp/ch-2.lsp b/challenge-085/jeongoon/common-lisp/ch-2.lsp index 5dc88c91d5..6803b2e1af 100644 --- a/challenge-085/jeongoon/common-lisp/ch-2.lsp +++ b/challenge-085/jeongoon/common-lisp/ch-2.lsp @@ -24,10 +24,11 @@ (defvar *max-power-factor* (isqrt *target*)) (loop for a from *max-power-factor* above 1 - do(loop for b from (floor (log *target* a)) above 1 - do(let ((c (expt a b))) - (when (= c *target*) - (format t "1 as ~d^~d = ~d~%" a b *target*) - (quit))))) + do(let* ((b (floor (log *target* a))) + (c (expt a b))) + (when (= c *target*) ;; problem with log precision + ;; need to check directly. + (format t "1 as ~d^~d = ~d~%" a b *target*) + (quit)))) (format t "0") -- cgit