#include <iostream> #include <cmath> using namespace std; const int NOTFOUND = -1; int Primes[7000]; int Len; void GetPrimes(void) { bool flag[65002] = {false}; int i,j; for (i = 2; i < sqrt(65002.0)+1; i++) { if (!flag[i]) for (j = i + i; j < 65001;j += i) flag[j] = true; } for (i = 2;i < 65001;++i) if (!flag[i]) Primes[Len++] = i; } int binarysearch(int A[],int low,int high,int x) { int mid; while (low <= high) { mid = low + (high - low) / 2; if (A[mid] < x) low = mid + 1; else if (A[mid] > x) high = mid - 1; else return mid; } return NOTFOUND; } int main() { unsigned n; GetPrimes(); while (scanf("%u",&n),n) { unsigned i; if (binarysearch(Primes,0,Len-1,n) != NOTFOUND) { printf("%d is normal./n",n);continue; } for (i = 2; i < n;++i) { unsigned sum = 1,j = i,iTemp = n; bool flag = false; while (iTemp) { if (iTemp & 1) sum = (sum * j) % n; j = (j * j) % n; iTemp >>= 1; } // printf("i = %d sum = %d/n",i,sum); if ((sum % n) != i) break; } if (i == n) printf("The number %d is a Carmichael number./n",n); else printf("%d is normal./n",n); } return 0; }