Hi all, I have to program a recursion to find the answer to a maths question, the recursion formula I am working with is:

f(a,b) = f(a,b-1) - f(a/g(b),b-1)

where g is an arbitary function that is easy to use

I also have the condition that f(a,0)=a

What is the best way to go about programming this kind of thing in C?

My initial idea was to have the function call itself if b wasn't 0, but that doesn't seem to work, will this method work or is there a much better SIMPLE way?