/*****************************************************************************/
/*									     */
/* OUTER LOOP								     */
/* 11/14/06 (dkc)							     */
/*									     */
/*****************************************************************************/
unsigned int furtest(unsigned int d);
unsigned int eloop(unsigned int d, unsigned int k, unsigned int n,
		   unsigned int outsize, unsigned int *output);
extern unsigned int error[];
extern unsigned int d;
unsigned int dloop(unsigned int din, unsigned int k, unsigned int n,
		   unsigned int outsize, unsigned int *output) {
unsigned int i;
for (i=din; i>2; i--) {
   d=i;
   if (furtest(i)!=0)
      continue;
   n=eloop(i, k, n, outsize, output);
   if (n>outsize) {
      error[0]=6;
      break;
      }
   }
return(n);
}