Counting problem - How many times an inequality holds? Let $k>2$ be a natural number and let $b$ be a non-negative real number. 
Now, for each $n$, $m \in \{ 1, 2, ... k \}$, consider the following inequalities:
$$ mb < k - n $$
We have $k^2$ inequalities. How can I count the couples of $n$ and $m$ such that the inequality (for $n$ and $m$ fixed) holds?
Clearly, an algorithm would easily give an answer. But I was wondering if there is a "more-mathematical" solution.

Presumably $b$ is given.  We can note that the right side ranges from $0$ to $k-1$, so define $p=k-n \in [0,k-1]$ and ask about $mb \lt p$.  For a given $p$, the number of allowable $m$ is $\lfloor \frac {p-1}b \rfloor$  So we are asking for $\sum_{p=1}^{k-1}\lfloor \frac {p-1}b \rfloor$  Let $q=\lfloor \frac {k-2}b\rfloor$  Then $$\sum_{p=1}^{k-1}\lfloor \frac {p-1}b \rfloor=b\sum_{i=0}^{q-1}i+q(k-1-bq)=\frac{bq(q-1)}2+q(k-1-bq)$$ because the left sum starts with $b\ \ 0$'s, $b\ \ 1$'s, on to $b \ \ q-1$'s and finish with $q$'s.
