Clustering via Pattern Formation

27 Views Asked by At

I have a range of numbers for instance: $$x = (-2,0,3,10,11,15,100,111,112,113).$$

How do I multiply this set of values ($x$) to yield the following ranges? \begin{align*} x_1 &= (-2,0,3),\\ x_2 &= (10,11,15),\\ x_3 &= (100,111,112,113). \end{align*} As a computer scientist, I would find the absolute difference between each value then sort it in a list. This is not very optimal.

I was wondering if there exists mathematical functions that allow me to sort the numbers into clusters? Please help!