Module aoc::year2016::day25

source ·
Expand description

§Clock Signal

Like Day 12 and Day 23 this problem is all about reading code not writing code.

Reverse engineering the code shows that it takes the initial value of a then adds two constants multiplied by each other to create a seed.

This seed is then repeatedly bit shifted right by dividing by 2 using an inefficient linear time loop. The remainder (the bit that drops off) is the output. This means that output sequence is simply the binary digits of a + offset in reverse repeated over and over.

To obtain the desired pattern we need the next highest binary number that has the pattern 101010...

Functions§