Skip to content

Instantly share code, notes, and snippets.

@ghaiklor
Last active January 5, 2016 16:49
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/9e05ef6320306ff7e50e to your computer and use it in GitHub Desktop.
Save ghaiklor/9e05ef6320306ff7e50e to your computer and use it in GitHub Desktop.
Advent of Code (Day 25)
const ROW = 3010;
const COLUMN = 3019;
const FIRST_CODE = 20151125;
const TARGET_INDEX = ((Math.pow(ROW + COLUMN - 1, 2) + ROW + COLUMN - 1) / 2) - ((ROW + COLUMN - 1) - COLUMN);
let result = FIRST_CODE;
for (var i = 1; i < TARGET_INDEX; i++) {
result = (result * 252533) % 33554393;
}
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment