I need something similar than asked here, but more the other way round:
Given a list of numbers (example from the question above): [1, 6, 9, 100, 102, 105, 109, 134, 139] I do not want to say the max gap (in that example 10) but how many groups I would like.
e.g. 3 groups: 1, 6, 9 / 100, 102, 105, 109 / 134, 139 2 groups: 1, 6, 9 / 100, 102, 105, 109, 134, 139 ...
this should work relative, as my numbers are very, very different: [0.1, 0.2, 1, 4, 100, 110] => 3 groups should lead to 0.1, 0.2 / 1, 4 / 100, 110
although 0.2 and 1 are nearer than 1 and 5 in absolute terms (0.8 vs. 3) in relation 0.2 is further away from 1 (5x) than to 0.1 (2x).
I hope it gets clear somehow what I would like to achieve...