sorry i couldn't think of better title
so i have a number lets say 13(variable) and by dividing it to 5 (constant)
i get my groups (3 in this example )
1 => 1-5
2 => 6-10
3 => 11-13
now i want to know group of each number between 1-13
groups = roundsUp(number / 5) ;
in this example what is the formula to get group(1 or 2 or 3) of each number (1 to 13)
You seem to already understand how to get from item number $i$ to group number $g$, in the formula you have given - your
groups = roundsUp(number / 5);which might be written $g=\lceil \frac{i}{5}\rceil$ (those are doing the same thing - $\lceil x \rceil$ is the smallest integer greater than or equal to $x$).If you want the first item number of a group, it's $i_F=5(g-1) +1$, and the last item number in group $g$ is of course $i_L=5g$, except that you need to check that this does not exceed the last item number.
I've written these (in particular $i_F$) so that if the constant $5$ changes, you can just swap the new number in place.
Are any or all of these what you were asking for?