Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Babbage-problem/Clojure/babbage-problem.clj
Normal file
11
Task/Babbage-problem/Clojure/babbage-problem.clj
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
; Defines function named babbage? that returns true if the
|
||||
; square of the provided number leaves a remainder of 269,696 when divided
|
||||
; by a million
|
||||
(defn babbage? [n]
|
||||
(let [square (* n n)]
|
||||
(= 269696 (mod square 1000000))))
|
||||
|
||||
; Use the above babbage? to find the first positive integer that returns true
|
||||
; (We're exploiting Clojure's laziness here; (range) with no parameters returns
|
||||
; an infinite series.)
|
||||
(first (filter babbage? (range)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue