Catalan number

I was reading about Catalan numbers on Geeksforgeeks and found this

C_n=rac{(2n)!}{(n+1)!n!}=rod_{k=2}^{n}rac{n+k}{k} for neq 0

Is this true ? After solving for 4 and 5 results are different from the standard ones.

It’s absolutely correct…just multiply and divide RHS by (n+1)! and combining numerator leads to the expression in LHS. Also C(4) = 14…both sides are giving same value…check again…

1 Like

It’s correct, giving same answers as the standard ones

1 Like

In dark theme the expression u wrote is hidden :rofl: , I changed first to normal then read what u post :slight_smile:

2 Likes

LOL, I prefer dark theme on IDEs only xD

1 Like

Could you explain how ? i’m still getting wrong answer.

Show your code…

I’m using it to calculate the no. of unique BST’s. I don’t have any direct implementation to show.

i was doing like this
A/c to me
for n = 4 expression will look like
((4 + k) / k)*((4 + k)/ k)… till k = n starting from 2.

ok…so product is over ‘k’ and you get:
((4+4)/4) * ((4+3)/3) * ((4+2)/2)…simply this and see what you get…

for n = 4 it will be 12 i guess.

You are doing some silly mistake in your calculations which I think you would be able to figure out after some time…I can clearly see there is a 7 in the middle term, how can you get 12??

Just for last time can you write each term separately, yeah i’m doing this mistake again and again
like this
A/c to me n = 4
k = 2 ((4 + 2)/2) = 3
k = 3 ((4 + 3 )/ 3) = 2
k = 4 ((4 + 4)/ 4) = 2

3 * 2 * 2 = 12 :grimacing:

The term k = 3, (4+3)/3 = 7/3 and not 2…

1 Like

Ugh !! finally got it thank you so much :smiley: