function [est,s,l,u,p]=ross_3_13(A,n,c)
% The function simulates a generalized version of exercise 3.13 in Ross :
%  Estimate E(N) and the probability mass function of N, where 
%  Let N=max{n: X_1 X_2 ... X_n >= exp(-A)}, where X_1, X_2, iid random variables U(0,1)
%  Inputs : A (constant in the bound), n=number of scenarios for N generated, c=confidence level for the confidence interval for the mean. 
%  Vector V contains the generated values of N for each scenario. 
%  The mean is estimated as a confidence interval 100c%. To do this, the function cint(N, c) is called. 
%  The pmf is computed by calling function pmfestimation(N)
	
	V=zeros(n,1);
	for i=1:n
	      P=1;N=0;
	      while P>=exp(-A) 
	      	P=P*rand(1); 
	      	N=N+1;
	      end;
	      V(i)=N-1;
	  end;
	  [est,s,l,u]=cint(V, c);
	  p=pmfestimation(V);