/*CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C                                                                             C
C  COMPUTE NUMBER OF DIVISORS (assumes N is divisible by 360)		      C
C  10/16/15 (DKC) (starts after N=2520=360*7)				      C
C                                                                             C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC*/
#include <stdio.h>
#include <math.h>
#include "table2.h"
//
unsigned int MAXN=2000000000;  // maximum N (to be multiplied by 360)
unsigned int BEGINN=7;	// beginning N (to be multiplied by 360)
//
void main() {
unsigned int N,h,i,p,count,maxcnt,t,total,flag2,flag3,flag5;
FILE *Outfp;
Outfp = fopen("out1ac.dat","w");
//
// compute convolutions
//
maxcnt=48;
for (N=BEGINN; N<=MAXN; N++) {
   t=N;
   flag2=4;
   flag3=3;
   flag5=2;
   count=0;
   while ((t&1)==0) {
      count=count+1;
      t=t>>1;
      }
   flag2=flag2+count;
   count=0;
   while (t==(t/3)*3) {
      count=count+1;
      t=t/3;
      }
   flag3=flag3+count;
   count=0;
   while (t==(t/5)*5) {
      count=count+1;
      t=t/5;
      }
   flag5=flag5+count;
   total=flag2*flag3*flag5;
//   printf(" N=%d t=%d %d %d %d \n",N,total,flag2,flag3,flag5);
   if (t==1)
      goto askip;
   h=(unsigned int)(sqrt((double)t)*19.0);
   for (i=3; i<17983; i++) {
      p=table[i];
      if (p>h)
	 goto askip;
      count=0;
      while (t==(t/p)*p) {
	 t=t/p;
	 count=count+1;
	 }
      total=total*(count+1);
      }
   printf("error \n");
   goto zskip;
askip:
   if (total>maxcnt) {
      maxcnt=total;
      printf(" %d %d \n",N,total);
      fprintf(Outfp," %d, %d, \n",N,total);
      }
   }
zskip:
fclose(Outfp);
return;
}