#P8883. 幻想中成为原神

幻想中成为原神

Background

Zhongli really likes math problems.

Problem Description

One of the problems is as follows: Define a Hilichurl as killable if and only if there exists a perfect square greater than 11 that can divide its index. For example, Hilichurl 1212 is killable because it is divisible by 44; Hilichurl 1515 is not killable. Please calculate how many Hilichurls with indices 1∼n1\sim n are killable. Since Zhongli follows the principle of “that’s about enough,” he allows your answer to have an absolute error of at most 2×1042\times10^4 compared to the true answer.

Input Format

This problem contains multiple queries. The first line contains an integer TT, representing the number of queries.

Each query contains one line with a positive integer nn.

Output Format

For each query, output one line containing an integer, representing the number of killable Hilichurls with indices 1∼n1\sim n.

3
10
32678
9686985

3
12814
3797988

Hint

Sample Explanation

Among 1∼101\sim 10, only the 33 Hilichurls 4,8,94,8,9 are killable, so the answer is 33.

Note that since your output is allowed to have an absolute error of 2×1042\times 10^4 from the standard answer, outputs such as −2,3,20003-2,3,20003 will all be considered correct.

Constraints

  • Subtask 1(10 pts)\text{Subtask 1(10 pts)}: n≤105n\le 10^5.
  • Subtask 2(20 pts)\text{Subtask 2(20 pts)}: n≤107n\le 10^7.
  • Subtask 3(20 pts)\text{Subtask 3(20 pts)}: n≤109n\le 10^9.
  • Subtask 4(20 pts)\text{Subtask 4(20 pts)}: T=1T=1.
  • Subtask 5(30 pts)\text{Subtask 5(30 pts)}: no special properties.

For 100%100\% of the testdata, it holds that 1≤n≤10181\le n\le 10^{18}, 1≤T≤1041\le T\le 10^4, and nn is guaranteed to be chosen randomly within the range.

Translated by ChatGPT 5