function [ab,dig]=dig_blockhahn(n,N,a,b,eps0,dig0,dd,nofdig)
%DIG_BLOCKHAHN Number of digits needed for polynomials orthogonal
%with respect to the eps0-block-discrete Hahn weight function
%   [AB,DIG]=DIG_BLOCKHAHN(n,N,A,B,EPS0,DIG0,DD,NOFDIG) determines 
%   the number DIG of digits needed to obtain the first n recurrence
%   coefficients for the eps0-block_discrete Hahn weight function 
%   W(X;N+1,A,B,EPS0) on [0,2N+1] to an accuracy of NOFDIG decimal 
%   digits, using the classical Chebyshev algorithm. The procedure 
%   increments an initial estimate DIG0 by DD units until the 
%   required accuracy is achieved. The recurrence coefficients are 
%   placed to NOFDIG digits into the nx2 array AB.

i=dig0-dd; 
maxerr=1;
while maxerr>.5*10^(-nofdig)
  i=i+dd; dig=i
  mom=mom_blockhahn(dig,n,N,a,b,eps0);
  if i==dig0
    ab0=schebyshev(dig,n,mom);
  else
    ab1=schebyshev(dig,n,mom);
    serr=abs((ab1-ab0)./ab1);
    err=double(serr);
    maxerr=max(max(err)); 
    ab0=ab1;
  end
end
ab=vpa(ab1,nofdig);
