## 代码

#include <cstdio>
#include <cstring>
#include <algorithm>

int const N = 1000005;

int tp, prime[N], rec[N], vis[N], sum[N];

void init() {
for (int i = 2; i < N; ++i) {
if (!vis[i]) {
prime[tp++] = i;
}
for (int j = 0; j < tp && i * prime[j] < N; ++j) {
vis[i * prime[j]] = 1;
if (i % prime[j] == 0) {
break;
}
}
}
for (int i = 2; i < N; ++i)
sum[i] = sum[i - 1] + !vis[i];
}

int main() {
init();
int q;
scanf("%d", &q);
for (; q--;) {
int a, b;
scanf("%d%d", &a, &b);
long long ans = 0;
for (int i = 0; i < tp && prime[i] < b;) {
int cnt = b / prime[i] - (a - 1) / prime[i];
int nxt = 1e9;
if (b / prime[i]) nxt = std::min(nxt, b / (b / prime[i]));
if ((a - 1) / prime[i]) nxt = std::min(nxt, (a - 1) / ((a - 1) / prime[i]));
ans += 1ll * cnt * (cnt - 1) / 2 * (sum[nxt] - i);
i = sum[nxt];
}
printf("%lld\n", ans);
fflush(stdout);
}
return 0;
}


## Spring II

It was a surprise to discover a new nest opposite the window.

Through the telescope, I scrupulously watched the doves in the nest, who were reposing restfully. Narrowly I discerned that they were a family comprised of a mother and two babies. Sighing with relief, I thought, “Finally the dove has returned, and luckily I can still see the family.” I even expected to witness the first flight of the baby doves.

I started wondering where the doves came from, as it was odd that they were inclined to construct their home here between the buildings, and after a period of cogitating, I ultimately deduced that once they might live in the decrepit houses nearby which were to be pulled down owing to the modernization and urbanization.

From this viewpoint, the doves seemed to be pitiable. “It can be tough for them to find a congenial shelter in the city.” I uttered in my heart, as I observed them fluttering their gray wings. It looked as if they were enjoying the serene life. Yet my brain did not cease contemplating.

Living in the era with rapid technological advancements which largely hasten our pace of life, we ineluctably forgo the joyous time being close to nature. And not until the demise of the erstwhile happiness we attained from nature comes do we realize that it is deplorable to turn ourselves into a hardened machine.

The blood-red sun was sinking and a livid cloud in the east received its rays. A twinge of woe surged through me. If we humanity kept pursuing interests by damaging the environment, what would the attendant consequence be? Would it only be driving the doves homeless?

I couldn’t help recalling the days when the city was shrouded in thick smog, and people could scarcely distinguish the things in the distance. And the rivers in the city, which were limpid before, had become turbid in recent decades. The foregoing instances were attributed to human activities. Not to mention the global warming, the ozone depletion, and the extinction of multitudinous species. Urbanization was just all of these in miniature.

The sky was tinted with black inch by inch, and the doves quieted down again. I shifted my eyes from them.

I leaned on the windowsill, looking up at the firmament, which used to be spangled with innumerable stars that were now unseen to us. Embedded aloft in the inky night sky, the pale yellow full moon cast its glow over the city, like an infinite piece of cloth mantling, yet faraway as the neon lights were, their harsh beams penetrated the textile that the moon carefully sewed without any difficulty, as if it was nonexistent. The dazzling rays pricked not only my eyes, but also my heart. “Perhaps the doves dread the blinding light, too.”

There was a time when all the doves could flit from tree to tree jovially in the dense and emerald woodlands, where they interacted with other creatures complying with the principles of nature. It was not until human beings arose that changes occurred. Trees were felled at first, and then sewage and fumes were disgorged by pipes. As the time elapsed our compunction was attenuated unawares by the profits we gained at the price of the environment we lived. We averted our gaze from what was prime, focusing on what was subordinate. The cupidity for gain and the scant heed we paid to conservation incurred the mire we confront today.

We really should pause, ruminate for a while, and inquire ourselves, what is our original orientation, and does what we endeavor to do diverge from that aim. Is our purpose to make every hue around us grey? Or to fetter ourselves in the forest of reinforced concrete? Or, to alter the earth to meet human’s multifarious demands regardless of the sustainability?

The onus is on us to maintain an agreeable environment. We need introspection, though it may seems arduous to atone for the devastation.

Fortunately, we gradually awake to the pernicious effects, and we are making a change. Eco-civilization construction has been put forward, and the departments concerned are sparing no effort to ameliorate the imbalanced ecology.

It was late spring, and every plant was flourishing. I heard the birds warbling a mellifluous night chorus, my heart mollified.

I entertain the hope that one day, we can thoroughly relish the felicity from nature. I envision an unspoiled environment. If we esteem nature, make optimal decision, and take prompt action.

I’m looking forward to the arrival of that very day.