You can't solve for n without more information!!. If you know the answer to the combination, then maybe you can get somewhere. Even so, it would very difficult to solve for n, especially if n is large. Example: nC5 =591,600,030=n! / {[n - 5]! * 5!} =591,600,030.
You can try to solve for n, but it is very difficult because iteration and interpolation will have to be used to find n. In this example n=150.
Agree, but you cn just trial and error it to 'zero' in on n
for n C5 = 591600030 you should know that n is large start at 100....too small try 200 too large
150 ? perfect n = 150
"if I only know r and the answer in ncr problem, how can I calculate n?"
I thought this was an interesting question, and, although there is no direct, closed form solution, it isn't too difficult to produce a systematic iterative method to find n - see below. I've used k as the number of combinations. i.e. we have ncr(n,r) = k; so the problem is: given r and k find n. (Note: the floor(x) function calculates the nearest integer that is less than or equal to x).
We must have r <= n <= floor(r*k1/r) , so:
____________________________
Initial high guess n = floor(r*k1/r)
Initial alternative m = r (i.e. chosen such that m is different from n in general)
While |n - m| > 0 do the following
m = n
K = ncr(n,r)
if K = 1 then return n and stop
else n = floor[ (n - r)*ln(k)/ln(K) + r ]
End while loop
return n
_____________________________
With the example given by Guest#2 r = 5, k = 591600030, this routine returns n = 150.