Last active
October 1, 2017 13:49
-
-
Save lagenorhynque/8f446243be22f33b77f2c4c50d76b3f8 to your computer and use it in GitHub Desktop.
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
| ;; 0 <= x <= 23 | |
| ;; 0 <= y <= 23 | |
| ;; x + y = 23 | |
| ;; 2x + 4y = 62 | |
| user> (for [x (range (inc 23)) | |
| y (range (inc 23)) | |
| :when (and (= (+ x y) 23) | |
| (= (+ (* 2 x) (* 4 y)) 62))] | |
| [x y]) | |
| ([15 8]) | |
| ;; 0 <= x <= 40 | |
| ;; 0 <= y <= 40 | |
| ;; 0 <= z <= 40 | |
| ;; x = 3z | |
| ;; 120x + 150y + 200z = 5720 | |
| user> (for [x (range (inc 40)) | |
| y (range (inc 40)) | |
| z (range (inc 40)) | |
| :when (and (= x (* 3 z)) | |
| (= (+ (* 120 x) (* 150 y) (* 200 z)) 5720))] | |
| [x y z]) | |
| ([21 12 7]) | |
| user> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment