use recurrence to calculate catalan numbers