voidInitPTable(){ for (int i = 2; i <= MAXN; ++i) { if (IsPrime[i] == false) { PTable.push_back(i); for (int j = 2 * i; j <= MAXN; j += i) { IsPrime[j] = true; } } } }
intmain(){
int T; InitPTable(); scanf("%d", &T); longlong Left, Right; while (T--) { scanf("%lld%lld", &Left, &Right); int MAX = ceil(sqrt(static_cast<double>(Right))); int Ans = 0; for (constint& Prime : PTable) { longlong i = static_cast<longlong>(Prime) * Prime; if (i > Right) { break; } while (i < Left) { i *= Prime; } if (i <= Right) { ++Ans; } while (true) { i *= Prime; if (i > Right) { break; } ++Ans; } } printf("%d\n", Ans); }