問題一覧 > 通常問題

No.3692 Calculate Mu

レベル : / AI推定難易度 : 450 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 63
作問者 : Unbakedbread / テスター : Tamiji153
お気に入りにしたユーザー ProblemId : 13822 / 自分の提出
問題文最終更新日: 2026-09-07 01:44:01
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
μ関数入門コース (順位表) の他の問題:

Problem Statement

You are given a positive integer $N$. Find $\mu(N)$.

What is $\mu(N)$? (click to expand) For a positive integer $N$, the value of $\mu(N)$ is defined as follows.
  • If $N=1$, then $\mu(N)=1$.
  • If $N$ is divisible by the square of some prime, then $\mu(N)=0$.
  • If $N$ is equal to the product of $K$ distinct primes, then $\mu(N)=(-1)^K$.

Constraints

  • $N$ is an integer between $1$ and $10^{12}$, inclusive.

Input

$N$

Output

Output the answer.

Sample

Sample 1
Input
30
Output
-1

$30$ can be expressed as $2\times 3\times 5$, a product of $3$ distinct primes. Therefore, $\mu(30)=(-1)^3=-1$.

Sample 2
Input
54
Output
0

$54$ is divisible by $3^2=9$, the square of the prime $3$. Therefore, $\mu(54)=0$.

Sample 3
Input
1
Output
1

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