Today i was solving a programming problem and got stuck at this position.
Value of nCr is given where r = floor((n+1)/2). We will have to find the value of n ?
Help, please.
Today i was solving a programming problem and got stuck at this position.
Value of nCr is given where r = floor((n+1)/2). We will have to find the value of n ?
Help, please.
Copyright © 2021 JogjaFile Inc.
If $n$ is even, we have the central binomial coefficient $m=_{2r}C_r=\frac {(2r)!}{(r!)^2}\approx \frac {4^r}{\sqrt {\pi r}}$ so given $m$ we can take $r_0=\frac 12\log_2 m$ (which ignores the denominator), $r_{1}=r_0+\frac 14 \log_2(\pi r_0)$ (which adds more factors to account for the denominator). Round up. Check if it fits. For example $m=1.3784E11, r_0=18.50214, r_1=19.9672, r=20$ is correct. This will fail only if $r$ is very large so the change in the denominator from the first to second iteration is so large you need another factor of $4$ or two.
If $n$ is odd, we have $m=_{2r-1}C_r$ We can make use of the above by calculating $m'=_{2r}C_r=2m$ (Can you prove this?) Find $r$ as above for $m'$. See if it fits.