]> www.fi.muni.cz Git - aoc.git/blobdiff - 2017/34.pl
The rest of Year 2017
[aoc.git] / 2017 / 34.pl
diff --git a/2017/34.pl b/2017/34.pl
new file mode 100755 (executable)
index 0000000..20aab6d
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use v5.30;
+use strict;
+
+my $in = 345;
+
+my $pos = 0;
+my $val;
+for (1 .. 50_000_000) {
+       $pos += $in;
+       if ($_ > 1) {
+               $pos %= $_;
+       } else {
+               $pos = 0;
+       }
+       $pos++;
+       $val = $_ if $pos == 1;
+}
+
+say $val;
+