math - What is the equation to calculate the CurrentGroup -


Trying to understand an equation to get an existing group, if they were grouped like below, then a page Will happen.

variable:

  PageSize = 5 page index = 21 group size = 5 total rectangles = 1000 current page = page index + 1  
< P> Find:

<1000> And if you have a group size of 5 then there are 200 groups (total rectangles / group sizes). This means that the current page 22 should be in Group 5

  Group 1: 1 2 3 4 5 Group 2: 6 7 8 9 10 Group 3: 11 12 13 14 15 Group 4 : 16 17 18 1920 Group 5: 21 22 23 24 25   

Formula < / P>

  1 + floor ((current page -1) / group size)  

test

  1 - & gt; 1 .. 5 - & gt; 1 6 - & gt; 2 .. 9 - & gt; 2 .. 22 - & gt; 5  

Comments