AoC 2024 Day 22: Xorshiftinator

Source: Day 22: Monkey Market

Full solution for today (spoilers!).

Part 1

Implement a PRNG with the following update function:

  1. Multiply by 64, xor with the previous value, modulo 16777216
  2. Divide by 32, xor with the previous value (from step 1), modulo 16777216
  3. Multiply by 2048, xor with the previous value (from step 2), module 16777216

For each of a series of seeds, sum the 2000th generated number.

read more...