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.
|
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
|