#nt1003. 互质集合
互质集合
Coprime Subsets
Problem Description
There are queries. Each query gives a number ; count how many non-empty subsets of have greatest common divisor equal to . Output the answer modulo .
Input Format
The first line contains one integer .
Each of the next lines contains one integer .
Output Format
Output lines, each containing one number: the answer.
Sample Input
3
10
1000
1000000
Sample Output
983
912086516
822856275
Constraints
For all test cases, and .