docs: def consecutivegaps(n, leftmargin = 0, rightmargin = 0):
      """Compute all possible single consecutive gaps in any sequence of the specified length. Returns
      (beginindex, length) tuples. Runs in  O(n(n+1) / 2) time. Argument is the length of the sequence rather than the sequence itself"""
      begin = leftmargin
      while begin < n:
          length = (n - rightmargin) - begin
          while length > 0:
              yield (begin, length)
              length -= 1
          begin += 1