Skip to content

Instantly share code, notes, and snippets.

@ponkore
Created April 25, 2012 13:17
Show Gist options
  • Save ponkore/2489634 to your computer and use it in GitHub Desktop.
Save ponkore/2489634 to your computer and use it in GitHub Desktop.
Project Euler Problem 5
;;;2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
;;;What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
;;;2520 は 1 から 10 の数字の全ての整数で割り切れる数字であり、そのような数字の中では最小の値である。
;;;では、1 から 20 までの整数全てで割り切れる数字の中で最小の値はいくらになるか。
;;; 1から20までの数値全体での最小公倍数を求める。数値2つについては、
;;; (clojure.math.numeric-tower/lcm a b) で求められるので、reduce で畳み込む。
(use '[clojure.math.numeric-tower])
(reduce lcm (take 20 (iterate inc 1)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment