0
$\begingroup$

I have this problem about account record pagination. I have to write the function that describes the total pages needed to contain those account records.

This is the problem:

# Account record quantity to store per page
per_page € R 
# Account records to insert in pages
tot_acc € R 

# The total pages needed to store the `tot_account` quantity
f(per_page,tot_acc) = tot_page € R = ? 

I need to find f(per_page,tot_acc).

  • 0
    You'll need to explain what these quantities mean.2011-03-12
  • 0
    @joriki I updated the question.2011-03-12

1 Answers 1

1

Are you asking something like:

With all variables as integers, given the first page number of a set of accounts $i$, the number of accounts that can fit on a page $d$, the total number of accounts $n$, what is the number of the last page?

If so, then you need to use $\left\lceil \frac{n}{d}\right\rceil$ pages for the accounts where the brackets mean ceiling i.e. round up to the next integer. You need to add that to the page before the starting point $i-1$ to give the final page of the accounts $$f(i,d,n) = \left\lceil \frac{n}{d}\right\rceil + i -1$$ or if you prefer $$\text{tot_page} = f(\text{page, per_page, tot_acc}) = \left\lceil \frac{\text{tot_acc}}{\text{per_page}}\right\rceil + \text{page} -1.$$

Perhaps you were asking something else.