/*CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                             C
C  COMPUTE DIFFERENCE IN NUMBER OF FRACTIONS				      C
C  09/30/15 (DKC) (maxima based on sigma0(x))				      C
C                                                                             C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC*/
#include <stdio.h>
#include <math.h>
mertenaw(unsigned int, unsigned int *count, unsigned int I);
unsigned int MAXN=30000;  // maximum N
unsigned int BEGINN=2;	// beginning N
unsigned int I=8;
int k=3;
//
void main() {
unsigned int N,i,dcount,maxcnt,count[2];
int save,temp;
double sum;
FILE *Outfp;
Outfp = fopen("out1bzw.dat","w");
maxcnt=0;
for (N=BEGINN; N<=MAXN; N++) {
   mertenaw(N, count, I);
   save=(int)count[0]-(int)count[1];
   temp=save;
   if (temp<0)
      temp=-temp;
   if (temp!=k)
      continue;
   sum=(double)save*(double)save;
   dcount=1;
   for (i=2; i<=N; i++) {
      if (N!=(N/i)*i)
	 continue;
      dcount=dcount+1;
      mertenaw(N/i, count, I);
      sum=sum+((double)count[0]-(double)count[1])*((double)count[0]-(double)count[1]);
      }
   if (dcount>maxcnt) {
      maxcnt=dcount;
      printf(" %d %d %d %d \n",N,(unsigned int)sum,dcount,save);
      fprintf(Outfp," %d, %d, %d, %d, \n",N,(unsigned int)sum,dcount,save);
      }
   }
fclose(Outfp);
return;
}