Function Repository Resource:

# FindRanges

Find continuous ranges in a list of integers

Contributed by: Jan Pöschko (Wolfram Research)
 ResourceFunction["FindRanges"][list] returns ranges of consecutive values for the integers in list.

## Details and Options

The list is sorted before detecting ranges. The returned ranges are in ascending order.

## Examples

### Basic Examples

Find ranges of consecutive values in a list of integers:

 In[1]:=
 Out[1]=

### Scope

The given list does not need to be sorted, but will be sorted automatically:

 In[2]:=
 Out[2]=

### Properties and Relations

The returned ranges can be joined into the original set of numbers again:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

### Possible Issues

Non-integer numbers are “swallowed” if they’re between consecutive integers in the list:

 In[7]:=
 Out[7]=

Expressions that are not integers or real numbers constitute their own “range” each:

 In[8]:=
 Out[8]=

## Requirements

Wolfram Language 11.3 (March 2018) or above