I don't think there is any easier way than successively dividing by the base and keeping the remainder. Of course dividing number represented in an arbitrary base would require a linear amount of work as well.
Lets say that f represents the number N then basically
g(1) = N % c;
g(2) = (N / c) % c;
....
....
....
It may not be necessary to to compute N explicitly, you could just do it implicitly in the base b.