Problem 3336 · Hard

Find the Number of Subsequences With Equal GCD

Track the gcd of two disjoint growing subsequences at once, so each number either joins one side, joins the other, or is skipped.

Open the interactive visualisation