Recursion exercises in Ruby