# [✓] Sum and Solve the following expression?

GROUPS:
 The following does not work: Solve[Sum[(-1)^(k-1)*Binomial[71,k]*(1-(71-k)/71)^n,{k,1,71}]=0.5,n] I want to find the smallest value for n where that sum will yield at least 0.5. But, when I enter that formula, Mathematica tells me, In[2]:= Solve[Sum[(-1)^(k-1)*Binomial[71,k]*(1-(71-k)/71)^n,{k,1,71}]=0.5,n] k - 1 71 - k n Set::write: Tag Sum in Sum[(-1) Binomial[71, k] (1 - ------) , {k, 1, 71}] is Protected. 71 Solve::naqs: 0.5 is not a quantified system of equations and inequalities. Out[2]= Solve[0.5, n] Is there a different syntax I can use so that it will calculate n for me?
1 year ago
4 Replies
 Jim Baldwin 1 Vote You need to use == rather than = when using Solve (and similar functions). However there is no n that makes the sum exactly equal to 1/2.Here's a brute-force method: Calculate a bunch of values for n and then take the smallest n that results in a probability of at least 0.5: data = Table[{n, N[Sum[(-1)^(k - 1)*Binomial[71, k]*(1 - (71 - k)/71)^n, {k, 1, 71}]]}, {n, 1, 500}]; sol = Select[data, #[[2]] >= 1/2 &][[1]] (* {329,0.5036576494672924} *) So the n you're looking for is 329.A better way is to use the While function: n = 1; While[Sum[(-1)^(k - 1)*Binomial[71, k]*(1 - (71 - k)/71)^n, {k, 1, 71}] < 1/2, n = n + 1] n (* 329 *) N[Sum[(-1)^(k - 1)*Binomial[71, k]*(1 - (71 - k)/71)^n, {k, 1, 71}]] (* 0.5036576494672924 *)