/****************************************************************************** * * * COMPUTE MERTENS FUNCTION * * 04/02/10 (dkc) * * * ******************************************************************************/ #include <math.h> double fastloc(unsigned int x,unsigned int u, char *mob, int *M) { unsigned int i,j,k,m,xom; double sumb; int temp; sumb=0.0; for (m=1; m<=u; m++) { temp=mob[m-1]; j=u/m+1; xom=x/m; k=(unsigned int)sqrt((double)xom); for (i=j; i<=k; i++) { if (temp<0) sumb=sumb-(double)M[xom/i-1]; if (temp>0) sumb=sumb+(double)M[xom/i-1]; } } return(sumb); }