Mega Man Zero 3

Euler problem 1

.

(proclaim '(optimize speed))

(reduce #'+ '(1 2 3 4))

; 10

(loop :for n :below 10 :collect n)

; (0 1 2 3 4 5 6 7 8 9)

(describe :below)

(defun range (max &key (min 0) (step 1))
   (loop :for n :from min :below max :by step
      collect n))
      
(- (+ (* 3 (reduce #'+ (range 334 :min 1 :step 1)))
      (* 5 (reduce #'+ (range 200 :min 1 :step 1))))
   (* 15 (reduce #'+ (range 67 :min 1 :step 1))))
   
; 233168

(defun sum-1-n (n)
  (/ (* n (+ n 1)) 2))
  
(- (+ (* 3 (sum-1-n 333))
      (* 5 (sum-1-n 199)))
   (* 15 (sum-1-n 66)))
   
; 233168

— Me@2022-08-01 03:29:01 PM

.

.

2022.08.01 Monday (c) All rights reserved by ACHK