@@ -0,0 +1,17 @@
+
+import Utils
+import Data.List
+layersSize :: [Int]
+layersSize = [1,3..999] |> map (+1)
+ |> concatMap (\x -> [x, x, x, x])
+solution :: Int
+solution = layersSize |> mapAccumL (\a x -> dup (a+x)) 1
+ |> snd
+ |> sum
+ |> (+1)
+main :: IO ()
+main = putStrLn ("Solution: " ++ show solution)
@@ -292,3 +292,6 @@ module Utils where
mapFindMaxInitial :: Ord b => (a -> b) -> [a] -> a
mapFindMaxInitial f l = map (addResult f) l |> maximumBy (\a b -> compare (snd a) (snd b)) |> fst
+ dup :: a -> (a,a)
+ dup x = (x, x)