Computes a factorial.