問題一覧 > 通常問題

No.3687 Coprime Count

レベル : / AI推定難易度 : 1700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 42
作問者 : Unbakedbread / テスター : Tamiji153
お気に入りにしたユーザー ProblemId : 13816 / 自分の提出
問題文最終更新日: 2026-08-07 14:51:06
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 positive integers $N,M$.

Find the number of pairs of a positive integer $a$ not greater than $N$ and a positive integer $b$ not greater than $M$ such that the greatest common divisor of $a$ and $b$ is $1$.

Constraints

  • $N,M$ are integers between $1$ and $10^7$, inclusive.

Input

$N\ M$

Output

Output the answer.

Sample

Sample 1
Input
3 5
Output
12

There are $12$ such pairs: $(a,b)=(1,1),(1,2),(1,3),(1,4),(1,5),(2,1),(2,3),(2,5),(3,1),(3,2),(3,4),(3,5)$.

Sample 2
Input
13 31
Output
266
Sample 3
Input
10000000 10000000
Output
60792712854483

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