問題一覧 > 通常問題

No.2016 Countdown Divisors

レベル : / AI推定難易度 : 1075 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 146
作問者 : milkcoffee / テスター : mink1618033
お気に入りにしたユーザー ProblemId : 8047 / 自分の提出
問題文最終更新日: 2022-05-03 22:54:45
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 353 (オムニバス) (順位表) の他の問題:

Problem Statement

Initially, $1$ positive integer $N$ is written on a blackboard.
When a positive integer $x$ is written on the blackboard, you perform the operation of rewriting the integer on the blackboard to $x-d(x)$, where $d(x)$ is the number of positive divisors of $x$.

For example, when $6$ is written on the blackboard, the number of positive divisors of $6$ is $4$, so you rewrite the number on the blackboard to $2$.

You repeat the operation until the integer written on the blackboard becomes $0$, and you stop once it becomes $0$. (It can be proved that repeating the operation always makes the integer on the blackboard $0$.)
Find the positive integer written on the blackboard immediately before it becomes $0$.

Answer for $T$ test cases.

Input

$T$
$case_1$
$case_2$
$\vdots$
$case_T$
Here, $case_i$ denotes the $i$-th test case.
Each test case is given in the following format.

$N$

  • $1 \leq T \leq 10^5$
  • $1 \leq N \leq 10^9$
  • All inputs are integers.

Output

Output the integer written on the blackboard immediately before it becomes $0$.
Output the answer to the $i$-th test case on the $i$-th line.

Sample

Sample 1
Input
3
6
1
3
Output
2
1
1

For the $1$st case, $6$ is initially written on the blackboard.
The number of positive divisors of $6$ is $4$. Since $6-4=2$, it is rewritten to $2$.
The number of positive divisors of $2$ is $2$. Since $2-2=0$, it is rewritten to $0$.
Since it has become $0$, the operation ends. The integer written immediately before $0$ is $2$.

For the $2$nd case, $1$ is initially written on the blackboard.
The number of positive divisors of $1$ is $1$. Since $1-1=0$, it is rewritten to $0$.
Since it has become $0$, the operation ends. The integer written immediately before $0$ is $1$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。