/******************************************************************************
*									      *
*  COMPUTE MERTENS FUNCTION						      *
*  11/04/18 (dkc)							      *
*									      *
******************************************************************************/
#include <math.h>
#include <stdio.h>
#include "table2.h"
extern char *malloc();
int mobius(unsigned int a, unsigned int *table, unsigned int tsize);
unsigned int primed(unsigned int *out, unsigned int tsize,
		    unsigned int *table,unsigned int limit);
unsigned int MAXN=100000;
void main () {
unsigned int i,j,t1size;
unsigned int tsize=17984;
unsigned int *table1;
int k;
FILE *Outfp;
Outfp = fopen("out9a.dat","w");
table1=(unsigned int*) malloc(80000008);
if (table1==NULL) {
   printf("not enough memory \n");
   return;
   }
t1size=primed(table1,tsize,table,10000000); // make larger prime look-up table
printf("prime look-up table size=%d, last prime=%d \n",t1size,table1[t1size-1]);
//
// compute Mertens function
//
printf(" mobius\n");
j=1;
fprintf(Outfp," %d \n",1);
printf(" %d \n",1);
for (i=2; i<=MAXN; i++) {
   k=mobius(i,table1,t1size);
   j=j+k;
   printf(" %d %d %d \n",i,k,j);
   fprintf(Outfp," %d, \n",j);
   }
fclose(Outfp);
return;
}