wrote recursion sum and factorial methods