```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define N 100005

int prime[N];
int c;
bool isVisit[N];

void tell(int n) {
    for (int i = 2; i <= n; ++i) {
        if (isVisit[i] == false)
            prime[++c] = i;
        for (int j = 1; j <= c && i * prime[j] <= n; ++j) {
            isVisit[i * prime[j]] = true;
            if (i % prime[j] == 0)
                break;
        }
    }
}

int main(void) {
    isVisit[0] = true;
    isVisit[1] = true;
    tell(N);
    int n;
    while (scanf("%d", &n)!= EOF) {
        if (!isVisit[n])
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}
```

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 1000007

int vis[N], prime[N];

void sieve(int n) {
    int k = 0;
    memset(vis, 0, sizeof(vis));
    vis[0] = vis[1] = 1;
    for (int i = 2; i <= n; i++) {
        if (vis[i] == 0)
            prime[k++] = i;
        for (int j = 0; j < k; j++) {
            if (i * prime[j] > n)
                break;
            vis[i * prime[j]] = 1;
            if (i % prime[j] == 0)
                break;
        }
    }
}

int main() {
    sieve(N);
    int n;
    while (scanf("%d", &n)!= EOF) {
        if (vis[n] == 0)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}
```

```c
#include <stdio.h>
#include <stdbool.h>

#define MAXN 100001

bool is_prime[MAXN];

void sieve() {
    for (int i = 2; i < MAXN; i++) {
        is_prime[i] = true; // 初始化所有数为素数
    }
    is_prime[0] = is_prime[1] = false; // 0和1不是素数

    for (int i = 2; i * i < MAXN; i++) {
        if (is_prime[i]) {
            for (int j = i * i; j < MAXN; j += i) {
                is_prime[j] = false; // 标记合数
            }
        }
    }
}//用空间换时间

int main() {
    sieve(); // 进行素数筛选

    int n;
    while (scanf("%d", &n) != EOF) {
        if (is_prime[n]) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }

    return 0;
}

```

