Euler problem 14.1.1
.

(defun range (max &key (min 0) (step 1)) (loop :for n :from min :below max :by step collect n)) (defun col (n c) (cond ((= n 1) c) ((evenp n) (col (/ n 2) (1+ c))) ('t (col (1+ (* 3 n)) (1+ c))))) (defun max-item (lst) (loop :for item :in lst :maximize item)) (defun e14 () (let* ((c-lst (mapcar #'(lambda (x) (col x 1)) (range 1000001 :min 1))) (max-len (max-item c-lst)) (max-index (1+ (position max-len c-lst)))) (list max-index max-len))) (time (e14)) ;; Evaluation took: ;; 1.084 seconds of real time ;; (837799 525)
— Me@2023-07-03 12:33:40 AM
.
.
2023.07.03 Monday (c) All rights reserved by ACHK

You must be logged in to post a comment.