From 56a0f22357bcd6e6eac1cb75b298396b4e9352f4 Mon Sep 17 00:00:00 2001 From: TimStallard Date: Thu, 28 Dec 2017 13:09:34 +0000 Subject: [PATCH] fixed bug with day 15 --- day15/part1.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/day15/part1.js b/day15/part1.js index 1d1967d..f560e12 100644 --- a/day15/part1.js +++ b/day15/part1.js @@ -4,7 +4,8 @@ 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)){ + padding = "0000000000000000"; + if((padding+a.toString(2)).slice(-16) == (padding+ b.toString(2)).slice(-16)){ total++; console.log(i); console.log(a, b);