#include <stdio.h>
#include <stdlib.h>
int prime_local(int n, int m) {
div_t d;
return ((d = div(n, m)).rem == 0) ? 0 : (d.quot < m) ? 1 : prime_local(n, m + 1);
}
int prime(int n) { return (n == 1) ? 0 : (n == 2) ? 1 : (prime_local(n, 2)); }
int main() {
int n;
#if 1
do { printf("n = \n"); scanf("%d", &n);
} while (n <= 0);
#else
for (n = 2; n < 100; n++)
#endif
printf((prime(n) ? "%d prime number.\n" : "%d not prime\n"), n);
return 0;
}
/* end */
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBwcmltZV9sb2NhbChpbnQgbiwgaW50IG0pIHsKICBkaXZfdCBkOwogIHJldHVybiAoKGQgPSBkaXYobiwgbSkpLnJlbSA9PSAwKSA/IDAgOiAoZC5xdW90IDwgbSkgPyAxIDogcHJpbWVfbG9jYWwobiwgbSArIDEpOwp9CgppbnQgcHJpbWUoaW50IG4pIHsgcmV0dXJuIChuID09IDEpID8gMCA6IChuID09IDIpID8gMSA6IChwcmltZV9sb2NhbChuLCAyKSk7IH0KCmludCBtYWluKCkgewogIGludCBuOwoKI2lmIDEKICBkbyB7IHByaW50ZigibiA9IFxuIik7IHNjYW5mKCIlZCIsICZuKTsKICB9IHdoaWxlIChuIDw9IDApOwojZWxzZQogIGZvciAobiA9IDI7IG4gPCAxMDA7IG4rKykKI2VuZGlmCiAgcHJpbnRmKChwcmltZShuKSA/ICIlZCBwcmltZSBudW1iZXIuXG4iIDogIiVkIG5vdCBwcmltZVxuIiksIG4pOwogIHJldHVybiAwOwp9Ci8qIGVuZCAqLwo=