aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-112/ulrich-rieke/haskell/ch-2.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/challenge-112/ulrich-rieke/haskell/ch-2.hs b/challenge-112/ulrich-rieke/haskell/ch-2.hs
new file mode 100644
index 0000000000..9c935587e8
--- /dev/null
+++ b/challenge-112/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,8 @@
+module Challenge112
+ where
+import Data.List ( permutations , nub )
+
+stepcounter :: Int -> Int
+stepcounter n = length $ concat $ map (nub . permutations) [ replicate t 1 ++
+ replicate o 2 | t <- [0 .. n] , o <- [0 .. div n 2] , sum ( replicate t 1 ++
+ replicate o 2 ) == n]