sum, with loop and recursion versions