No.890 Modes of Limited Transposition
タグ : / 解いたユーザー数 119
作問者 :
trineutron
/ テスター :
QCFium
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もしくは右上の雲マークをクリックしてアカウントを作成してください。