#include <stdio.h>
bool isPrime_2(int n){
if ((n == 2) || (n == 3)) return 1;
if ((n % 6 != 1) && (n % 6 != 5)) return 0;
for (int i = 5; i*i <= n; i += 6){
if ((n%i == 0) || (n % (i + 2) == 0))
return 0;
}
return 1;
}
void xuanxian2(int n, int m)
{
int i, s = 0;
for (i = n; i <= m; i++){
if (isprime_1(i)){
printf("%d ", i);
}
}
printf("\n");
}
void xuanxian1(int n)
{
int i,total = 1;
for (i = 2; i <= n; ++i) total *= i;
printf("%d\n", total);
}
void xuanxian3(int n)
{
if (((n % 400) == 0) || (((n % 4) == 0) && ((n % 100) != 0))){
printf("%d是闰年\n", n);
}
else{
printf("%d非闰年\n", n);
}
}
int main()
{
int count, i, d = 0;
int data[100] = {};
int index[100] = {};
scanf("%d", &count);
for (i = 0; i < count; ++i){
scanf("%d", &index[i]);
switch (index[i])
{
case 1: scanf("%d", &data[d]); d += 1; break;
case 2: scanf("%d %d", &data[d], &data[d+1]); d += 2; break;
case 3: scanf("%d", &data[d]); d += 1; break;
}
}
d = 0;
for (i = 0; i < count; ++i){
printf("\n");
printf("1 计算n!\n");
printf("2 输出素数\n");
printf("3 判定闰年\n");
switch (index[i])
{
case 1: xuanxian1(data[d]); d += 1; break;
case 2: xuanxian2(data[d], data[d + 1]); d += 2; break;
case 3: xuanxian3(data[d]); d += 1; break;
default: printf("INPUT ERROR!\n");
}
}
return 0;
}