Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

https://adventofcode.com/2023/day/8

the script times out on val.town, so I ran it with deno on my machine for some mintes.

By running

deno run https://esm.town/v/karfau/aoc23_08 | grep z

I observed a repeating pattern in the output...

each "track" was reaching the same position over and over again, but not on the same lines.

I dumped the beginning of the output into a text file, opened it to look at the patterns and confirmed that each "track" had a fixed frequency for each position ending on a Z.

so I took the "step"(+1 because it's zero based) and checked the primes each of them contains, to get the correct input. I calculated that with a calculator and copied in the number.

Migrated from folder: adventofcode/_2023/aoc23_08