Davenport-Schinzel sequence

Davenport-Schinzel sequences are sequences that give rise to a function that grows very close to linearly.

An \((n,s)\) Davenport-Schinzel sequence is a sequence \(a_1,a_2,\ldots,a_m\) where \(a_i\) are integers in \([1,n]\), such that:


 * \(a_i \neq a_{i+1}\)
 * There is no sequence \(i_1 < i_2 < \cdots < i_{s + 2}\) such that \(a_{i_1} = a_{i_3} = a_{i_5} = \ldots \neq a_{i_2} = a_{i_4} = a_{i_6} = \ldots\).