#P10989. [2015杭电多校]GCD Tree
[2015杭电多校]GCD Tree
GCD Tree
Problem Description
Teacher Mai has a graph with vertices numbered from to . For every edge(,), the weight is gcd(,). (gcd(,) means the greatest common divisor of number and ). You need to find a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is maximized. Print the total weight of these edges.
Input
There are multiple test cases(about ). For each test case, there is only one line contains one number .
Output
For each test case, print the answer.
Sample Input
1
2
3
4
5
Sample Output
0
1
2
4
5
Author
xudyh
Source
2015 Multi-University Training Contest 9