4 $log = Logger
.new(STDERR)
5 $log.level
= Logger
::WARN
7 abundant_numbers
= (12..28124).select
{|i
| i
.abundant
?}
9 candidates
= Array
.new(28124) {|i
| i
}
12 abundant_numbers
.each_index
do |i
|
13 j
= abundant_numbers
.length
- 1
15 candidates
[abundant_numbers
[i
] + abundant_numbers
[j
]] = nil
16 $log.info
{"Eliminating #{abundant_numbers[i] + abundant_numbers[j]} as the sum of #{abundant_numbers[i]} and #{abundant_numbers[j]} (i=#{i}, j=#{j})" }
21 # p candidates.compact
22 p candidates
.compact
.reduce(:+)