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
package fromtheafricanwoman | |
/** | |
* Developed with pleasure | |
* User: hamsterofdeath | |
* Date: 18.11.12 | |
* Time: 01:09 | |
*/ | |
object Bees { | |
def main(args: Array[String]) { |
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
package euler | |
import collection.immutable.TreeMap | |
import collection.mutable | |
/** | |
* Developed with pleasure | |
* User: hamsterofdeath | |
* Date: 03.10.12 | |
* Time: 22:01 |
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
package euler | |
/** | |
* Developed with pleasure | |
* User: hamsterofdeath | |
* Date: 07.12.12 | |
* Time: 23:09 | |
*/ | |
object Problem119 { | |
def main(args: Array[String]) { |
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
(ns euler.Problem119) | |
(defn sumOfDigits [num] | |
"little helper function which gets the mod 10 of a number, divides it by 10, repeats - the result is the sum | |
of digits" | |
(cond | |
(zero? num) 0 | |
:else (+ (mod num 10) (sumOfDigits (bigint (/ num 10)))))) | |
; helper function to get x |
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
(ns euler.Problem104) | |
(defn fibs [];memory leak if "def", must be "defn" without parameters! otherwise, | |
; the complete list of numbers is kept in memory even though we don't need those | |
(let [start [0 1] | |
next (fn [[a b]] [b (+' a b)]) | |
pairs (iterate next start)] | |
(map #(first %) pairs))) | |
(def pandigitals (map #(first [%]) "123456789"));get a list of characters |
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
(ns euler.Problem125) | |
(defn is-palindrome [n] | |
(let [s (str n)] | |
(= (seq s) (reverse s)))) | |
(defn to-check [] | |
(filter is-palindrome (range 1 100000000))) | |
(defn square-root [n] |
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
(ns euler.Problem11) | |
(def number-grid | |
(let [numbers | |
"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 | |
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 | |
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 | |
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 | |
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 | |
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 |
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
package euler | |
import scala.None | |
/** | |
* Developed with pleasure | |
* User: hamsterofdeath | |
* Date: 15.12.12 | |
* Time: 09:31 | |
*/ |
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
(ns euler.Problem11) | |
(def number-grid | |
(let [numbers | |
"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 | |
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 | |
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 | |
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 | |
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 | |
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 |
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
(ns euler.Problem11) | |
(def number-grid | |
(let [raw-string | |
"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 | |
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 | |
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 | |
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 | |
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 | |
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 |