Skip to content

Commit

Permalink
2024/22
Browse files Browse the repository at this point in the history
  • Loading branch information
encse committed Dec 31, 2024
1 parent 7c0fd24 commit b3bb623
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions 2024/Day22/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public object PartTwo(string input) {
int[] Diff(IEnumerable<int> x) => x.Zip(x.Skip(1)).Select(p => p.Second - p.First).ToArray();

IEnumerable<int> SecretNumbers(int seed) {
var mixAndPrune = (int a, long b) => (int)((a ^ b) % 16777216);
var mixAndPrune = (int a, int b) => (a ^ b) & 0xffffff;

yield return seed;
for (var i = 0; i < 2000; i++) {
seed = mixAndPrune(seed, seed * 64L);
seed = mixAndPrune(seed, seed / 32L);
seed = mixAndPrune(seed, seed * 2048L);
seed = mixAndPrune(seed, seed << 6);
seed = mixAndPrune(seed, seed >> 5);
seed = mixAndPrune(seed, seed << 11);
yield return seed;
}
}
Expand Down

0 comments on commit b3bb623

Please sign in to comment.