close the catalan problem of keep change to buy tickets problem to calculate the catalan number