/*****************************************************************************/
/*									     */
/*   INNER LOOP 							     */
/*   11/14/06 (dkc)							     */
/*									     */
/*****************************************************************************/
unsigned int furtest(unsigned int e);
unsigned int comfact(unsigned int d, unsigned int e, unsigned int count);
unsigned int furcond(unsigned int d, unsigned int e);
unsigned int euclid(unsigned int a, unsigned int b);
void depower(unsigned int d, unsigned int e, unsigned int p, unsigned int *S);
unsigned int search(unsigned int *S, unsigned int k);

unsigned int eloop(unsigned int d, unsigned int k, unsigned int n,
		   unsigned int outsize, unsigned int *output) {
unsigned int e,count;
unsigned int S[2];
for (e=d-1; e>0; e--) {
   if (((d/2)*2==d)&&((e/2)*2==e))
      continue;
   if (furtest(e)!=0)
      continue;
   if (comfact(d,e,4)!=0)
      continue;
   if (euclid(d,e)!=1)
      continue;
   if (furcond(d,e)!=0)
      continue;
   depower(d,e,3,S);
   count=search(S,k);
   if (count!=0) {
      output[n]=d;
      output[n+1]=e;
      output[n+2]=count;
      n=n+3;
      if (n>outsize)
	 break;
      }
   }
return(n);
}