diff --git a/2024/day22.exs b/2024/day22.exs index ca0c2da..e5a53f2 100755 --- a/2024/day22.exs +++ b/2024/day22.exs @@ -8,12 +8,9 @@ defmodule Day22 do def next(secret) do secret - |> then(fn secret -> (secret * 64) |> mix(secret) end) - |> prune() - |> then(fn secret -> div(secret, 32) |> mix(secret) end) - |> prune() - |> then(fn secret -> (secret * 2048) |> mix(secret) end) - |> prune() + |> then(fn secret -> (secret * 64) |> mix(secret) |> prune() end) + |> then(fn secret -> div(secret, 32) |> mix(secret) |> prune() end) + |> then(fn secret -> (secret * 2048) |> mix(secret) |> prune() end) end def mix(num, secret), do: Bitwise.bxor(secret, num)