From efc9d51f522378580423f5339784d9208f82d2e8 Mon Sep 17 00:00:00 2001 From: Sebastian Seedorf Date: Wed, 30 Dec 2020 19:39:33 +0100 Subject: [PATCH] Day 25 --- day25/input.txt | 2 ++ day25/part1.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 day25/input.txt create mode 100644 day25/part1.py diff --git a/day25/input.txt b/day25/input.txt new file mode 100644 index 0000000..9235afa --- /dev/null +++ b/day25/input.txt @@ -0,0 +1,2 @@ +8458505 +16050997 diff --git a/day25/part1.py b/day25/part1.py new file mode 100644 index 0000000..86cdba6 --- /dev/null +++ b/day25/part1.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +c_pub, d_pub = [int(x.strip()) for x in open("input.txt")] + +val = 1 +less_loop, less_pub = None, None +for loop in range(1, 20201227): + val = (val*7) % 20201227 + if val == c_pub: + less_loop, less_pub = loop, d_pub + break + elif val == d_pub: + less_loop, less_pub = loop, c_pub + break + +val = 1 +for _ in range(less_loop): + val = (val*less_pub) % 20201227 +print(val)