let me add a comment to Michael Somos's reply: this is a famous problem in group theory, and there's unlikely to be a general formula NJAS