Run this notebook

Use Livebook to open this notebook and explore new ideas.

It is easy to get started, on your machine or the cloud.

Click below to open and run it in your Livebook at .

(or change your Livebook location)

<!-- livebook:{"file_entries":[{"name":"04.txt","type":"attachment"}]} --> # Advent of Code 2023 - Day 15 ```elixir Mix.install([ {:kino, "~> 0.11.0"}, {:kino_aoc, github: "ljgago/kino_aoc"} ]) ``` ## Input <!-- livebook:{"attrs":{"assign_to":"puzzle_input","day":"15","session_secret":"AOC_SESSION","year":"2023"},"chunks":null,"kind":"Elixir.KinoAOC.HelperCell","livebook_object":"smart_cell"} --> ```elixir {:ok, puzzle_input} = KinoAOC.download_puzzle("2023", "15", System.fetch_env!("LB_AOC_SESSION")) ``` ```elixir input = puzzle_input |> String.split(",", trim: true) |> Enum.map(&String.to_charlist/1) ``` ## Part 1 ```elixir hash = fn chars -> Enum.reduce(chars, 0, fn c, acc -> acc |> Kernel.+(c) |> Kernel.*(17) |> Kernel.rem(256) end) end input |> Stream.map(hash) |> Enum.sum() ``` ## Part 2 ```elixir ``` [![Run in Livebook](https://livebook.dev/badge/v1/blue.svg)](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fpehbehbeh%2Fadventofcode%2Fblob%2Fmain%2F2023%2F15.livemd) <!-- livebook:{"offset":1040,"stamp":{"token":"XCP.CsfnCV1xSiOM3gpBGjly_tJEmM0OvK0OmRjy8tY2I8r-1ARnsRqQYpd_aDW1RZ15GRq2qG1yIz3XS3MNdaUNmac-k0P3-cN_eXPPkcwi2ut-aOlmOGI","version":2}} -->
See source

Have you already installed Livebook?

If you already installed Livebook, you can configure the default Livebook location where you want to open notebooks.
Livebook up Checking status We can't reach this Livebook (but we saved your preference anyway)
Run notebook

Not yet? Install Livebook in just a minute

Livebook is open source, free, and ready to run anywhere.

Run on your machine

with Livebook Desktop

Run in the cloud

on select platforms

To run on Linux, Docker, embedded devices, or Elixir’s Mix, check our README.

PLATINUM SPONSORS
SPONSORS
Code navigation with go to definition of modules and functions Read More ×