solve problem 14 in ruby. note the downto method as opposed to each