diff options
author | Marvin Borner | 2024-03-23 19:18:16 +0100 |
---|---|---|
committer | Marvin Borner | 2024-03-23 19:18:16 +0100 |
commit | 7bfc78b122ad9cbb65eed16f7de4d4021547c2a8 (patch) | |
tree | e45a22aeddb12257a94e32083ed10dfa3a0da66e /samples/euler/014.bruijn | |
parent | fc9980e5e19602748b8cc596cdd07c02ac2889f1 (diff) |
Some Project Euler solutions
Diffstat (limited to 'samples/euler/014.bruijn')
-rw-r--r-- | samples/euler/014.bruijn | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/samples/euler/014.bruijn b/samples/euler/014.bruijn new file mode 100644 index 0000000..5e0e906 --- /dev/null +++ b/samples/euler/014.bruijn @@ -0,0 +1,15 @@ +# TODO: Really slow + +:import std/Combinator . +:import std/List . +:import std/Math . +:import std/Number/Binary . + +hailstone-length y [[[0 =? (+1b) 1 go]]] (+0b) + go =²?0 (2 ++1 /²0) (2 ++1 (↑¹0 + 0)) + +solve [max-by (compare ⋔ hailstone-length) (take 0 (iterate inc (+1b)))] + +:test ((solve (+1000)) =? (+871b)) ([[1]]) + +main [solve (+1000000)] |