adventofcode/2015/20/2.pl
Yanick Champoux 2b88e2660e lots of days
2017-12-12 19:55:17 -05:00

19 lines
254 B
Perl

use 5.20.0;
use List::AllUtils qw/ sum /;
use Math::Prime::Util ':all';
my $x = 34000000;
my $house = 1;
$house++ while( nbr_gifts($house) < $x );
say $house;
sub nbr_gifts {
my $n = shift;
11 * sum grep { 50 * $_ >= $n } divisors($n);
}