#P11212. 『STA - R8』挑战 Goldbach 猜想

『STA - R8』挑战 Goldbach 猜想

Problem Description

There are qq queries. Each time, you are given a positive integer nn. Ask how many positive integers ii with ini \le n satisfy that both ii and nmodin\bmod i are prime numbers.

Input Format

The first line contains one positive integer qq.

The next qq lines each contain one positive integer nn.

Output Format

Output qq lines. Each line answers one query.

5
5
55
555
5555
55555
1
3
22
93
447

Hint

This problem uses bundled tests.

Constraints:

  • Subtask 1 (30 pts): q=1q = 1.
  • Subtask 2 (70 pts): no special constraints.

For all testdata, 1n,q2×1051 \le n,q \le 2\times10^5.

Luogu code length limit: 50 KB.

Translated by ChatGPT 5