By saying similarity I mean the numeric distance between them.
For example, 1,2,3 has a distance of 1, 7,9,10 has 2 in maximum, but between 1,2,3 and 7,8,9 is 4.
So if I say I like to group the numbers by distance 4, they will be added into different tree branches which first branch is 1,2,3 and the second branch is 7,9,10.

You didn’t say if the numbers are always in sequence or not? If not, Absolute(Abs, yellow group) should be used. Otherwise, negative numbers can appear which are always less than ‘Distance’.

This version uses random REAL numbers instead of integers, sorted or not.