Created
December 1, 2011 06:33
-
-
Save ypsilon-takai/1414335 to your computer and use it in GitHub Desktop.
project euler 68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Problem 68 : 2011/12/1 | |
| ;;"Elapsed time: 89.450754 msecs" | |
| (defn check-pe68 [tgt] | |
| (let [[[a2 a3 a4 a5] [b1 b2 b3 b4 b5]] tgt] | |
| (if (= 14 | |
| (+ 6 b1 b2) (+ a2 b2 b3) (+ a3 b3 b4) | |
| (+ a4 b4 b5) (+ a5 b5 b1)) | |
| [6 b1 b2 a2 b2 b3 a3 b3 b4 a4 b4 b5 a5 b5 b1] | |
| false))) | |
| (defn pe68 [] | |
| (filter check-pe68 | |
| (for [out (comb/permutations (range 7 11)) | |
| in (comb/permutations (range 1 6))] | |
| [out in]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment