Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
(defn divides? [k n] (zero? (mod k n)))

View file

@ -0,0 +1,6 @@
(defn prime? [x]
(or (= 2 x)
(and (< 1 x)
(odd? x)
(not-any? (partial divides? x)
(range 3 (inc (Math/sqrt x)) 2)))))

View file

@ -0,0 +1,9 @@
(declare prime?)
(def primes (filter prime? (range)))
(defn prime? [x]
(and (integer? x)
(< 1 x)
(not-any? (partial divides? x)
(take-while (partial >= (Math/sqrt x)) primes))))