Generate and Test solution to Hamming's problem

/***--------------------------------------
(Faster generate-and-test solutions might exist)
This is set up for the prime list 3,5,11
---------------------------------------***/

#include < stdio.h >
#include < limits.h >
#define N 10

/* Use define to make changing the variable size easy */

#define TYPE unsigned long
#define LIMIT ULONG_MAX
#define FORMAT "%ld\n"

int main()
{
  TYPE p[N];	/* Array of primes */
  TYPE n;	/* Number of elements in p */
  TYPE c,i;	/* Possibilities */
  int k;	/* temp variables */

  /* Primes must be ordered smallest to largest */
  n = 3;
  p[0] = 3;
  p[1] = 5;
  p[2] = 11;

  /* Here is the main part */
  for(i=2; i < LIMIT; i++)
  {
     c = i;
     for (k=0; k < n && c != 1; k++)
        while ((c % p[k]) == 0 && c != 1 && p[k] <= c) c = c/p[k];
     if (c == 1) printf(FORMAT,i);
  }
  return 0;
}