There is a recurrence for computing the n+1st Catalan Number from the 0th through the nth Catalan Numbers. See http://en.wikipedia.org/wiki/Catalan_number.
Something like this code fragment ought to do, assuming long long int is 64 bits: int CatalanNumber[1001]; int i,n; long long int x; CatalanNumber[0] = 1; for( n = 0 ; n < 1000 ; ++n ) { x = 0; for( i = 0 ; i <= n ; ++i ) x += (long long int)CatalanNumber[i] * (long long int)CatalanNumber[n-i]; CatalanNumber[n+1] = x % 10000; } Dave On Oct 9, 8:36 am, keyankarthi <keyankarthi1...@gmail.com> wrote: > can anyone suggest how to implement Catalan numbers.. upper limit > 1000, > > consider modulo 10000 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.