  Repeated idempotent elements are commonly used to characterise iterable
behaviours in abstract models of computation. Therefore, given a monoid $M$, it
is natural to ask how long a sequence of elements of $M$ needs to be to ensure
the presence of consecutive idempotent factors. This question is formalised
through the notion of the Ramsey function $R_M$ associated to M, obtained by
mapping every positive integer $k$ to the minimal integer $R_M(k)$ such that
every word $u$ in $M^*$ of length $R_M(k)$ contains $k$ consecutive non-empty
factors that correspond to the same idempotent element of $M$.
  In this work, we study the behaviour of the Ramsey function $R_M$ by
investigating the regular $D$-length of $M$, defined as the largest size $L(M)$
of a submonoid of $M$ isomorphic to the set of natural numbers $\{1,2, ...,
L(M)\}$ equipped with the Max operation. We show that the regular $D$-length of
$M$ determines the degree of $R_M$, by proving that $k^{L(M)} \leq R_M(k) \leq
(k|M|^4)^{L(M)}$.
  To allow applications of this result, we provide the value of the regular
$D$-length of diverse monoids. In particular, we prove that the full monoid of
$n \times n$ Boolean matrices, which is used to express transition monoids of
non-deterministic automata, has a regular $D$-length of $\frac{n^2+n+2}{2}$.
