[CF1139D]Steps to One
题目描述
Vivek initially has an empty array a and some integer constant m.
He performs the following algorithm:
Select a random integer x uniformly in range from 1 to m and append it to the end of a.
Compute the greatest common divisor of integers in a.
- In case it equals to 1, break
- Otherwise, return to step 1.
Find the expected length of a. It can be shown that it can be represented as $\frac {P}{Q}$ where $P$ and $Q$ are coprime integers and $Q≠0(mod {10^9+7})$. Print the value of $ P⋅Q^{-1}(mod 10^9+7)$.