Advent of Code 2019 - Day 22

Note: This topic is to talk about Day 22 of the Advent of Code 2019 .

There is a private leaderboard for elixirforum members. You can join it by following this link and entering the following code:


1 Like

Like many, I had tough time with this one, and wasn’t able to finish part 2 yesterday. It was quite frustrating, because I was partially on the right track, but it turned out that my math knowledge was not sufficient to figure all the needed pieces.

I spent a lot of time reading through the reddit spoilers thread, and I acquired a vague intuition on how to solve it, but I was still confused with bunch of math properties.

Based on that, I got an idea today which seemed relatively simple, and didn’t require the knowledge of formal principles and ideas mentioned on reddit (other than exponentiation by squaring).

You can find my solution here. I’ve provided an elaborate description in moduledoc.


I also had a hard time, but I didn’t want to look at any hints or spoilers at reddit, at least not until I had been stuck for at least 24 hours. I used other parts of the Internet, such as WolframAlpha and websites about number theory. As it happened, I continually made slow but steady progress.

My solution contains all four version of the solver algorithm (with comments) I developed during the last few days.