TITLE: There's something strange about $\sum \frac 1 {\sin(n)}$.
QUESTION [32 upvotes]: Clearly,
$$\sum_{n=1}^\infty \frac 1{\sin(n)}$$
Does not converge (rational approximations for $\pi$ and whatnot.) For fun, I plotted
$$P(x)=\sum_{n=1}^x \frac 1{\sin(n)}$$
For $x$ on various intervals. At first, I saw what you might expect:




Which is $P(x)$ for $x \in [0,20]$ and then $[0,300]$. Seems a little self-similar, but whatever. Then I looked at $P(x)$ on the interval $[360,700]$:



OK, that looks suspiciously like $P(x)$ on the interval $[0,300]$, but I'll toss out this coincidence as 'probably has to do with $\pi$ being irrational.' Here is $P(x)$ on $[700,1050]$:



And I observe similar behavior on similar intervals.
Putting it all together, here is $P(x)$ on $[0,20000]$:



It's converging? Not quite. Here is $P(x)$ on $[20000,100000]$:



So again, we're seeing the function 'get closer and closer, then get farther and farther, all while alternating' from some value, just as we saw on the smaller intervals. I suspect that if my computer could handle $P(x)$ on $[100000,200000]$, we would see the same thing (on a larger scale), though I'm not sure.
So: what's going on here? How can we explain this fractal-ish behavior?
Edit: I wonder if $P:\mathbb{N} \to \mathbb{R}$ is injective...

REPLY [2 votes]: Just for fun we could construct an integral representation of the sum: The inverse Mellin transform of $1/\sin(n)$ is 
$$
\mathcal{M}^{-1}\left[\frac{1}{\sin(n)}\right](x) = \frac{1}{1+x^\pi}
$$
which perhaps shows the relationship to $\pi$ more clearly. Then we can formally write 
$$
\int_0^\infty \left(\sum_{k=0}^n x^k \right)\frac{1}{1+x^\pi} \; dx = \sum_{n=1}^{n+1} \frac{1}{\sin(n)}
$$
or
$$
\int_0^\infty \frac{(x^{n+1}-1)}{(x-1)(1+x^\pi)} \; dx = \sum_{n=1}^{n+1} \frac{1}{\sin(n)}
$$
which apparently works for integer $n$. Now we can also numerically interpolate for some fractional $n$ such as $n=1/2$, although I can't vouch for the correctness of this continuation... This leads to a guess of the infinite limit of 
$$
\int_0^\infty \frac{1}{(1-x)(1+x^\pi)} \; dx = \sum_{n=1}^{\infty} \frac{1}{\sin(n)} \approx 1.256628
$$
although I'm not sure if the numeric integration just spat out some nonsense there...  The residue at $x=1$ appears to be $-1/2$.