the simple recursive sum function.
It is supposed to add all digits of a number. For example sum(123) = 1 + 2 + 3 = 7
It works by tail recursion. I take the fi