/*CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC C C C COMPUTE SUM OF EULER'S PHI FUNCTION C C 05/22/14 (DKC) C C C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC*/ #include <stdio.h> #include <math.h> unsigned int euclid(unsigned int d, unsigned int e); // unsigned int order=75; unsigned int out=0; // void main() { unsigned int g,h,i,j,k,l; unsigned int sum,losum,hisum,misum; FILE *Outfp; Outfp = fopen("out1r.dat","w"); for (g=2; g<=order; g++) { losum=0; hisum=0; misum=0; for (i=1; i<=g; i++) { sum=1; for (j=2; j<i; j++) { k=euclid(i,j); if (k==1) sum=sum+1; } misum=misum+sum; l=sum/4; h=l; if (sum!=l*4) h=h+1; losum=losum+l; hisum=hisum+h; // printf(" %d %d %d %d %d \n",i,sum,losum,hisum,misum); } if (out==0) fprintf(Outfp," %d\n",losum); else { if (out==1) fprintf(Outfp," %d\n",hisum); else fprintf(Outfp," %d\n",hisum-losum); } } fclose(Outfp); return; }