/******************************************************************************
* *
* COMPUTE MERTENS FUNCTION *
* 10/30/15 (dkc) *
* *
******************************************************************************/
#include <math.h>
long long newhicl(unsigned long long x, unsigned int u, char *mob, int *M) {
char temp;
unsigned int j,m;
unsigned long long xom,bot,delta;
unsigned long long i;
long long sumb;
sumb=0;
for (m=1; m<=u; m++) {
temp=mob[m-1];
if (temp==0)
continue;
xom=x/m;
j=(unsigned int)sqrt((double)xom);
j=j+1;
bot=xom/(unsigned long long)j;
i=(unsigned long long)j;
while (i<=xom) {
delta=xom/bot-i+1;
if (temp<0)
sumb=sumb-(long long)(M[bot-1]*delta);
else
sumb=sumb+(long long)(M[bot-1]*delta);
i=i+delta;
bot=bot-1;
}
}
return(sumb);
}