/*****************************************************************************/
/*									     */
/* COMPUTE SUM OF MERTENS FUNCTION					     */
/* 01/02/16 (dkc)							     */
/*									     */
/*****************************************************************************/
#include <math.h>
int newmert(unsigned int s, unsigned long long x, int *M) {
unsigned int t;
int i;
long long sum;
t=(unsigned int)sqrt((double)x);
t=t+2;
sum=0;
#pragma omp parallel for reduction (+:sum)
for (i=s; i<=(int)(x/(unsigned long long)t); i++)
   sum=sum+M[x/i-1];
#pragma omp parallel for reduction (+:sum)
for (i=1; i<(int)t; i++) {
   sum=sum+(long long)M[i-1]*(x/(unsigned long long)i-x/(unsigned long long)(i+1));
   }
return((int)sum);
}