/*CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                             C
C  COMPUTE DIFFERENCES IN NUMBER OF FRACTIONS (0 to 1/I, 1/I to 2/I)	      C
C  05/16/15 (DKC)							      C
C                                                                             C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC*/
#include <stdio.h>
#include <math.h>
void add64(unsigned int *A, unsigned int *B);
void sub64(unsigned int *A, unsigned int *B);
mertenau(unsigned int *N, unsigned int *count, unsigned int *I);
//
unsigned int I[2]={0,0x3b9aca00};	// even n value
unsigned int iters=20;
//
void main() {
unsigned int i,N[2],count[4],J[2],D[2];
FILE *Outfp;
Outfp = fopen("out1bap.dat","w");
J[0]=I[0];
J[1]=I[1];
J[1]=J[1]+1;
if (J[1]==0)
   J[0]=J[0]+1;
J[1]=(J[1]>>1)|(J[0]<<31);
J[0]=J[0]>>1;
N[0]=0;
N[1]=0;
for (i=0; i<iters; i++) {
   add64(J,N);
   mertenau(N, count, I);
   D[0]=count[2];
   D[1]=count[3];
   sub64(&count[0], D);
   printf(" %#010x %#010x %#010x %#010x %#010x %#010x %#010x %#010x\n",N[0],N[1],count[0],count[1],count[2],count[3],D[0],D[1]);
   fprintf(Outfp," %#010x %#010x \n",D[0],D[1]);
   }
fclose(Outfp);
return;
}