This is my solution:

class Integer
  def divisors
    res = []
    i = 1
    while i*i < self
      if self % i == 0
        res << i
      end
      i += 1
    end
    (res.size - 1).downto(1) do |k|
      res << self / res[k]
    end
    res << i if i*i == 0
    res
  end
end

def weird(n)
  div_sum = 0
  possible_sums = Hash.new
  possible_sums[0] = true

  n.divisors.each do |i|
    div_sum += i

    possible_sums.keys.each do |s|
      new_sum = s + i
      possible_sums[new_sum] = true if new_sum <= n
      return false if new_sum == n
    end
  end

  return div_sum > n
end

n = ARGV.shift or exit
n = n.to_i
m = ARGV.shift
m = m.to_i if m
range = m ? (n..m) : (1..n)
for i in range
  puts i if weird(i)
end

--
Paolo