Write recursive version of f(n)