問題一覧 > 通常問題

No.890 Modes of Limited Transposition

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 119
作問者 : trineutron / テスター : QCFium
お気に入りにしたユーザー ProblemId : 3169 / 自分の提出
問題文最終更新日: 2022-04-26 01:55:47
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 224 (順位表) の他の問題:

Problem Statement

Orion, a member of a choir, is going to sing a piece that uses a "mode of limited transposition" consisting of 6 or 8 notes of 12-tone equal temperament. A mode of limited transposition is a mode whose period is shorter than one octave. Orion became curious about how many modes of limited transposition consisting of $K$ notes exist in $N$-tone equal temperament. This problem can be rephrased as follows.

There are $N$ equally spaced points on a circle. When choosing $K$ points from them, how many ways of choosing have rotational symmetry?

Given $N$ and $K$, find the number of modes of limited transposition consisting of $K$ notes in $N$-tone equal temperament. Since the answer can be very large, find the remainder when the answer is divided by $10^9+7$.

Input

$N\ K$

All inputs are integers.
$1 \le N \le 10^6$
$1 \le K \le N$

Output

Output the number of modes of limited transposition consisting of $K$ notes in $N$-tone equal temperament, modulo $10^9+7$. Print a newline at the end.

Sample

Sample 1
Input
12 8
Output
15

Sample 2
Input
12 7
Output
0

Sample 3
Input
12 6
Output
24

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