adventofcode/15/1.pl
Yanick Champoux 3581d429e6 day15
2017-12-15 13:30:17 -05:00

19 lines
268 B
Perl

use 5.20.0;
use List::AllUtils qw/ pairgrep /;
my @v = ( 679,771 );
my $mask = 2**16 - 1;
my $match;
for ( 1..40_000_000 ) {
@v = ( 16807 * $v[0], 48271 * $v[1] );
$_ %= 2147483647 for @v;
$match += ($v[0] & $mask) == ($v[1] & $mask);
}
say $match;