Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try counting the number of pairs that have a GCD of <code>g</code.
Use inclusion-exclusion.
Solve with full IDE support and test cases