adventofcode-2017/day15/part1.js
2017-12-16 12:12:56 +00:00

14 lines
265 B
JavaScript

var a = 591;
var b = 393;
var total = 0;
for(var i = 0; i <= 40000000; i++){
a = (a*16807)%2147483647;
b = (b*48271)%2147483647;
if(a.toString(2).slice(-16) == b.toString(2).slice(-16)){
total++;
console.log(i);
console.log(a, b);
}
}
console.log(total);