Skip to content

Instantly share code, notes, and snippets.

@desrtfx
Last active March 10, 2016 05:42
Show Gist options
  • Save desrtfx/bda561ff5c32d3755d49 to your computer and use it in GitHub Desktop.
Save desrtfx/bda561ff5c32d3755d49 to your computer and use it in GitHub Desktop.
public class Day25 {
public final static long START = 20151125;
public final static int MULTIPLIER = 252533;
public final static int DIVISOR = 33554393;
public final static int TARGET_ROW = 3010;
public final static int TARGET_COL = 3019;
public static void main(String[] args) {
int iterator = 0;
long value = START;
for (int i = 1; i <= TARGET_COL; i++) {
iterator += i;
}
for (int i = 0; i < TARGET_ROW - 1; i++) {
iterator += TARGET_COL + i;
}
for (int i = 1; i < iterator; i++) {
value = (value * MULTIPLIER) % DIVISOR;
}
System.out.println("Part 1: Code is: " + value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment