🤖 AI Summary
This study addresses the problem of efficiently enumerating all inclusion-maximal arithmetic progressions (IMAPs)—maximal-length arithmetic subsequences not properly contained in any other—from a strictly increasing sequence of integers. We propose the first near-quadratic-time enumeration algorithm, achieving a time complexity of $\mathcal{O}(n^2 \frac{\log N}{\log \log N} + N)$, which significantly improves upon the previous bound of $\mathcal{O}(N^{2+o(1)}n)$. By integrating combinatorial analysis with efficient data structures, our method scales effectively to large input sequences. Furthermore, we provide the first rigorous estimate of the expected number of IMAPs in random sequences, along with asymptotic growth bounds, enabling practical structural analysis in domains such as complex musical rhythm modeling.
📝 Abstract
We present a simple $\mathcal{O}\left( n^2 \frac{ \log N }{ \log \log N } + N \right)$ enumeration algorithm for solving a problem from mathematical and computational music analysis where, given a strictly increasing integer sequence, $S$, with $n$ entries and maximum value $N$, the task is to enumerate all $m$ $\textit{inclusion-maximal arithmetic progressions (IMAPs)}$ in this sequence. An IMAP is a subsequence, $S' \subseteq S$ with $k>2$ integers, in which (i) the difference between any two consecutive integers is the same number, $d$ (i.e., $S'$ is an $\textit{arithmetic progression}$), (ii) $S'$ cannot be further extended to the left or to the right with any additional integers from $S$ while still remaining an arithmetic progression (i.e., $S'$ is a $\textit{maximal}$ arithmetic progression), and (iii) there is no other maximal arithmetic progression, $S'' \subseteq S$, which $\textit{properly}$ contains $S'$ (i.e., $S'$ is an $\textit{inclusion-maximal}$ arithmetic progression). We further provide proofs for the expected number of IMAPs in random integer sequences, $S$, and a bound on their order of growth. Finally, we provide empirical experiments comparing both (a) the practical running time performance of the proposed algorithm against that of a previously known algorithm which has higher time complexity $\mathcal{O}(N^{2+o(1)}n)$, and (b) the actual enumerated number of IMAPs to that of their mathematically expected number. Notably, the proposed algorithm demonstrates a significant improvement in running time over the previously known algorithm, and in immediate practical applications, will allow for more efficient analysis of large and rhythmically complex musical pieces.