You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/ruby/day_20.rb

15 lines
229 B

require "prime"
house = 1
while true
house += 1
factors = house.prime_division
presents = factors.map {|f,x| (x+1).times.map {|i| f**i }.inject(:+) }.inject(:*)
if presents >= 3600000
puts house
exit
end
end