#Define the Catalan Numbers C:=List([0..300],n->Binomial(2*n,n)/(n+1)); #C[i]=i-1st Catalan Number #Now we take the Catalan number and divide by 2^2n-1. P:=List([1..5000],n->(Binomial(2*(n-1),n-1)/(n))/(2^(2*n-1))); #P[i] is the probability that get equal # of heads and tails for the first time exactly after 2i tosses. for i in [1..15] do Print(P[i],"\n"); od; #What about the partial sums? L:=P[1]; for i in [2..10] do L:=L+P[i]; od; Float(L); #10th partial sum is 0.828 L:=P[1]; for i in [2..20] do L:=L+P[i]; od; Float(L); #20th partial sum is 0.8746 L:=P[1]; for i in [2..5000] do L:=L+P[i]; od; Float(L); #40th is 0.911 #60th is 0.927 #80th is 0.937 #100th is 0.9436 #200th is 0.96 #300th is 0.96744 #500th is 0.974775 #1000th is 0.9821 (FLOATING POINT FAILS) #5000th is 0.9919