Problem 3901 · Hard

Good Subsequence Queries

Keep the smallest subset size for each gcd among multiples of p, then check whether gcd p fits in fewer than n elements.

Open the interactive visualisation