Consider the strings $(b,b+1,b+2,...,b+l)$ of consecutive natural numbers, all less than some fixed natural number $n > b+l$. Is there a way to find the longest string (length of a string $= l+1$) with $\gcd(b+i,n) > 1$ for all $0\le i \le l$?
Arrange arithmetic sequences with distances given by the prime factors of $n$ so as to cover as many consecutive numbers as possible; for instance, if the prime factors are $2$, $3$, $5$ and $7$, this could be
I don't know whether there's a systematic way of doing this, but it seems that just using them from the smallest to largest whenever a new one is required to fill a gap might be optimal. Then by the Chinese remainder theorem, using the associated algorithm you can find the residue mod $n$ where this sequence is realized.