working version of sumofints in Ruby