#include #include #include using namespace std; bool pan[10000001] = { 0 }; int su[100001] = { 0 }; bool zhi[100001] = { 0 }; int main() { int begn, ends; int now = 0; cin >> begn >> ends; if(begn<2){ begn=2; } //cout << begn << ";" << ends << endl; int len = sqrt(ends); for (int i = 2; i <= len; i++) { //cout << i << "/"; if (zhi[i] == 0) { su[++now] = i; } for (int j = 1; j <= now && i * su[j]<= len; j++) { zhi[i * su[j]] = 1; if (i % su[j] == 0) { break; } } } for (int u = 1; u <= now; u++) { int i = su[u]; //cout << i << " "; for (int j = ends / i; i * j >= begn && j != 1; j--) { pan[i * j - begn] = 1; } } int ans = 0; for (int i = 0; i <= ends - begn; i++) { if (pan[i] == 0) { ans++; //cout<