Adding ryan's recursion solution for discussion