recursive answer to ruby2 ex1