/* ListFactors */

#include <stdio.h>

#define NN32 4793           /* Primefactors[4791] = 46337 */
#define MaxInt 46337

#include "..\\SubProgs\\GenLowerPrimes.c"

void main(void)
{
 int K,N, *P,  LowPrimes[NN32];

 GenLowerPrimes(LowPrimes);
LP1:
 puts("Input a natural number less than 46338 or zero to terminate program:");

LP2:
 scanf("%d",&N); getchar();
 if (!N) goto FIN;
 if (N>46337) {puts("Number to big"); goto LP1;}
 if (N<0) {puts("No negative numbers"); goto LP1;}

 K=2;    putchar('1');
 while (K<=N)
  {
   if (!(N%K))
    {
     printf(",%d",K);
     P=LowPrimes;
     while (*P<K) P++;
     if (*P==K) putchar('p');
    } 
   K++;
  }
 puts("\n\nInput a number");
 goto LP2;

FIN:
}
     


