write version of factorial using recur