Find the $\lim\limits_{k \to \infty} \frac{f(k)}{k^2} $ Let $\newcommand{\N}{\mathbb{N}}k$ be positive integer then we define the set
$$
A(k) := \Big\{(m,n)\in \N^2 : \big\vert k\cos\big(\frac{n\pi}{k}\big)\big\vert \leq m \leq k\sin\big(\frac{n\pi}{k}\big)\Big\}.
$$
Furthermore, we define the function
\begin{align}
f: \left\{
\begin{array}{rcl}
\N & \to &\N, \\
k & \mapsto & \vert A(k) \vert,
\end{array}
\right.
\end{align}
where $\vert A\vert$ is the number of elements of a set $A$.

Question: Does $\lim\limits_{k \to \infty} \frac{f(k)}{k^2}$ exist and if so how can it be calculated?

My attempts:

 A: Note that for all $a, b\in \Bbb R,$ it holds that $$
(b-a)^+-1 \le|\{x:a\le x\le b\}\cap \Bbb Z|\le (b-a)^++1
$$ where $c^+=\max\{c,0\}$.
Hence the number $N(k,n)$ of $m\in \Bbb Z$ satisfying $$
k\left|\cos \left(\frac{n\pi}{k}\right)\right|\le m \le k\sin\left(\frac{n\pi}{k}\right)
$$ satisfies $$k\left(\sin\left(\frac{n\pi}{k}\right)-\left|\cos \left(\frac{n\pi}{k}\right)\right|\right)^+-1 \le N(k,n)\le k\left(\sin\left(\frac{n\pi}{k}\right)-k\left|\cos \left(\frac{n\pi}{k}\right)\right|\right)^++1.$$ Since $f(k) =\sum_{n=1}^k N(k,n)$, this gives
$$
\left|\sum_{n=1}^kk\left(\sin\left(\frac{n\pi}{k}\right)-\left|\cos \left(\frac{n\pi}{k}\right)\right|\right)^+ -f(k)\right|\le k.
$$ It follows that
$$\begin{eqnarray}
\lim_{k\to\infty}\frac{f(k)}{k^2}&=&\lim_{k\to\infty}\sum_{n=1}^k\left(\sin\left(\frac{n\pi}{k}\right)-\left|\cos \left(\frac{n\pi}{k}\right)\right|\right)^+\frac{1}{k}\\&=&\int_0^1 (\sin \pi x-|\cos \pi x|)^+\mathrm{d}x\\
&=&2\int_{\frac{1}{4}}^{\frac{1}{2}}(\sin\pi x-\cos\pi x) \mathrm{d}x\\
&=&\frac{2}{\pi}\left[-\cos \pi x-\sin \pi x\right]^{\frac{1}{2}}_{\frac{1}{4}}=\frac{2}{\pi}(\sqrt{2}-1).
\end{eqnarray}$$
