#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "parameters.h"


#define sq(x) residue(square(x,p), p)




typedef char byte;
static byte *square1;
static int p=min_p-2;


int nextprime(int x)
{int  prime;
 prime = x+2;
while (! isprime(prime))
  prime = prime+2;
 return prime;
}


int issquare1(int x, int r)
{int y;
 y= residue(x+r,p);
 if (y == 0)
   return 0;
 else
   return (square1[y]>0)?1:-1;
}


main()
{int N1=0,i;
 int numprimes = 0;
 

square1 =(byte *)malloc((size_t)(1000000*sizeof(char)));
if (!square1)
   {printf("Insufficient memory \n");
   exit(1);}


 for(p = nextprime(p); p <max_p; p = nextprime(p))
   {
     N1 =0;
     numprimes++;
	
     for(i=0;i<p;i++)
     square1[i]=0;

   for(i=0;i<p;i++)
     square1[sq(i)]++;

   for(i=0;i<p;i++)
     if(f(i) > -1) 
       N1 +=2;
  
     
   N1 = N1-degree+1; /* - #ramification pts + 2#pts inft */
   printf(" %i %i\n", p, N1);
   
        }
 

exit(0);
}


















