Coprime Subsequences
HardRating 2000CodeforcesCombinatorics & Modular Arithmetic
Approach hintTry it first, then revealHide
Subsequences whose elements are all divisible by d number 2^cnt[d] - 1. Subtract the exact counts of the multiples of d, going from large d to small, to obtain the subsequences whose gcd is exactly d.