Fix $ a >0 $. Define $ f: \mathbb{N} \to \mathbb{R} $ by \begin{equation} f(n)= n + \lfloor k n - \tfrac{k }{2} +\tfrac12 \rfloor. \end{equation} Given an interval $ [a,b] \subset \mathbb{R} $, I want to figure out how many elements of the image of $ f $ lie in this interval.
My approach was to start with \begin{equation}\label{key} n + k n - \tfrac{k }{2} - \tfrac12 \le f(n) \le n + k n - \tfrac{k }{2} +\tfrac12, \end{equation}
and then invert the inequalities. However, I got stuck.