Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @author /u/Philboyd_Studge on 12/24/2015.
- */
- public class Advent25 {
- public static void main(String[] args) {
- final int ROWS = 2978;
- final int COLUMNS = 3083;
- final long START_CODE = 20151125;
- final int CODE_MULT_FACTOR = 252533;
- final int CODE_MOD_FACTOR = 33554393;
- long code = START_CODE;
- int iterations = 0;
- for (int i = 1; i <= COLUMNS; i++) {
- iterations += i;
- }
- for (int i = 0; i < ROWS - 1; i++) {
- iterations += COLUMNS + i;
- }
- for (int i = 1; i < iterations; i++) {
- code = (code * CODE_MULT_FACTOR) % CODE_MOD_FACTOR;
- }
- System.out.println(code);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment