Skip to content

Instantly share code, notes, and snippets.

@ghaiklor
Last active January 5, 2016 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghaiklor/e6f50913115058f67bd0 to your computer and use it in GitHub Desktop.
Save ghaiklor/e6f50913115058f67bd0 to your computer and use it in GitHub Desktop.
Advent of Code (Day 20 Part 1)
var INPUT = 34000000 / 10;
var houses = new Uint32Array(INPUT);
var houseNumber = INPUT;
for (var i = 1; i < INPUT; i++) {
for (var j = i; j < INPUT; j += i) {
if ((houses[j] += i) >= INPUT && j < houseNumber) houseNumber = j;
}
}
console.log(houseNumber);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment