adventofcode/2017/17/2.pl

17 lines
190 B
Perl
Raw Normal View History

2017-12-28 17:15:15 +00:00
use 5.20.0;
my $i = 380;
my $p = 0;
my $x;
use DDP;
for(1..50_000_000) {
say $_ unless $_ % 100_000;
$p = ( 1 + $p + $i ) % $_;
$x = $_ if $p == 1;
$p ||= $_;
}
say $x;