Finding the number of points at which $f(x)=[n+p\sin x]$ is not differentiable 
Let $f(x)=[n+p\sin x]$, $x\in(0,\pi)$, $n\in \mathbb{Z}$, $p$ be a prime number and $[x]$ represent the greatest integer less than or equal to $x$. Find number of points at which $f(x)$ is not differentiable.
  (A) $p$; (B) $p-1$; (C) $2p+1$; (D) $2p-1$.

My assumption: let us fix $n$, The value of $\sin x$ lies between $0$ and $1$ (inclusive). Let $p=2$, therefore the value of $p \sin x$ will change at $30$ and $150$ degrees. Hence for each value of $p$ there are two points where it is not differentiable, hence how do we find the correct answer?
 A: Let $f(x)=[n+p\sin x]$. Clearly $f(x)$ is not differentiable at those points where $n+p\sin x$ is an integer (since the greatest integer function is discontinuous at these points). $$$$Since $p$ is a prime number, for $f(x)$ to be $\textbf{ not differentiable }$, $n+p\sin x$ must be an integer ie $\sin x=\{1,-1,\frac rp\}$. This happens when $x=\{\frac {\pi}{2}, -\frac{\pi}{2}, \pi-\sin^{-1}\frac{r}{p}\}$ where $0\le r\le p-1$
$$$$But $x\ne \{-\frac{\pi}{2},0\}$ since $x\in(0,\pi)$$$$$
Thus, the function is not differentiable at $x=\{\frac{\pi}{2},\pi-\sin^{-1}\frac{r}{p}\}$ where $0<r\le p-1$
$$$$Thus, the required number of points is $1+2(p-1)=2p-1$
A: Let $n,p\in\mathbb{Z}$ with $p\geq 1$. Note that $f(x)=n+\lfloor p\sin(x)\rfloor$. Moreover $x\to p\sin(x)$ is a continuous function which is strictly increasing from $0^+$ to $p$  in $(0,\pi/2]$ and it is strictly decreasing from  $p$ to $0^+$ in $[\pi/2,\pi)$. 
It turns out that $f$ is piecewise constant: it attains the integer values $$n, n+1,\dots,n+p-1,n+p,n+p-1,\dots,n+1,n $$ 
and therefore $f$ is not differentiable at the points where it is not continuous. Can you take it from here?
