def remove_indices_from_range(ixs, max_ix):
    """From the indices 0:max_ix+1, remove the individual
    index values in ixs.
    Returns the remaining ranges of indices and singletons.
    """
    ranges = []
    i0 = 0
    for ix in ixs:
        i1 = ix - 1
        if i1 < i0:
            i0 = ix + 1
        elif i1 == i0:
            ranges.append([i0])
            i0 = ix + 1
        else:
            ranges.append([i0,i1+1])
            i0 = ix + 1
    if i0 < max_ix:
        ranges.append([i0, max_ix+1])
    elif i0 == max_ix:
        ranges.append([i0])
    return ranges