Problem 2584 · Hard

Split the Array to Make Coprime Products

Two products are coprime exactly when no prime divides both, so track how far each prefix prime reaches to the right.

Open the interactive visualisation