<Advent of Code 2024 day 22> (no spoilers) :thread...
# advent-of-code
a
Advent of Code 2024 day 22 (no spoilers) 🧵
d
Works on the test input, wrong answer on the real input... 🧐 🧐 🧐 (Part 2). Gotta take a break for now
b
trying to think of ways to choose/limit sequences on p2
d
I'll say what I'm doing in the spoilers thread
b
i tried one thing but it didn't work
m
Do you use Long as a result type?
d
The answer is the approach was sound but there was a bug that the test input didn't tickle.
I don't think you need to use Long as every step you mod by 2^24. However I started with Long so I have not verified for real.
m
Yeah for the rng Int is fine but I initially also used Int to sum up the values, which works for the test input but not for the real one
b
got it!
i defaulted to Long, but didn't check if its necessary
d
Checked, Int can overflow on
* 2048
=
shl 11
👍 1
because 24 + 11 > 31 🙂
e
yeah but it doesn't matter because the overflow is irrelevant after the prune
j
What the h*** am I reading?
🤣 1
d
I get negative numbers as a result of the overflow
Ah because of % instead of mod
I get a performance penalty switching to Int/mod from Long/%