#include <iostream>
using namespace std;
int main()
{
long long n,k;
cin >> n >> k;
bool tf = false;
k++;
for(long long i = 2;i * i <= k;i ++)
{
if(k % i == 0)
{
tf = true;
break;
}
}
if(tf)cout << 2 << endl;
else
{
n++;
if(k * 2 <= n)cout << 2 << endl;
else cout << 1 << endl;
}
return 0;
}
原文:https://www.cnblogs.com/QFNU-ACM/p/12830293.html