Hi, everyone. I want to know if the i — term (mod 1000000007) to the Catalan series could be calculated by this way. Do you, please, can explain me, if this way I get the answer by dp or if I need to do other thing? Thanks everybody.

fact[1][1] = 1; for(i=2;i<=1000;i++) { for(j=1;j<=i;j++) { if(j == 1) fact[i][1] = 1; else { if(i == j) fact[i][j] = fact[i][j-1] + fact[i-1][j-1]; else fact[i][j] = fact[i][j-1] + fact[i-1][j]; fact[i][j] %= 1000000007; } } }

Catalan series can be calculated as , so you can fo anything you do with binomial coefficients, good luck!

Thanks, man, I read about that too, but I need to know too what is the problem to use this way because I think it give me the numbers too. I appreciate your help. I will study with binomial coefficients.

You should know that

C_{2n}^{n}is in fact , so you can calculate both parts (take reminder of both) and divide first by second. Get reminder of such operation you can using your math, or simply multiply them and reverse element.Sorry for poor English, but I don't know how to explain it in English

No problem man, my first language is Spanish. Thank very much!!!

Some days ago i was thinking about it. And i made my own code:

As you can see, for calculating Catalan series I chose formula .

And for calculating C

_{n}^{k}I chose optimazed realization of standart algorithm.I think my code may help you. If not, I won't be offended :) Have a good time :)

Thanks man, I appreciate that too. I will try to prove my solution in other exercise. Have a nice day!!!