Consider a tree with undirected edges, where each node has an integer value. Adjacent nodes are said to be GCD-harmonic if the greatest common divisor (GCD) of their values is strictly greater than 1.
You can modify the value of any tree node to any positive integer. The cost of this operation is equal to the new node value, regardless of the node’s original value. You can change as many node values as needed, and node values do not need to be unique.
What is the minimum total cost to make every pair of adjacent nodes in the tree GCD-harmonic?