I want to split a number into $n$ parts and then take another number (which is less than or equal to the first number) and see which of the fractions the other number belongs to.
For example, split $100$ into $4$ parts. Which part does $36$ belong to? The second part, $26-50$.
For the record, I'm going to be using this in JavaScript so pseudo-code would be great but not required.
Perhaps something like this?