write method to return the factorial sequence for a given number