wip
Alpha Chen 9 years ago
parent ce1fc224af
commit e637ae3e78

@ -1,14 +1,16 @@
require "prime" houses = Hash.new(0)
house = 1 elf = 0
while true while true
house += 1 elf += 1
factors = house.prime_division 50.times do |i|
presents = factors.map {|f,x| (x+1).times.map {|i| f**i }.inject(:+) }.inject(:*) house = (i+1)*elf
houses[house] += 11*elf
if presents >= 3600000 if i.zero? && houses[house] >= 36000000
puts house puts house
exit exit
end
end end
end end

Loading…
Cancel
Save