# Finite sum $\sum_{n=2}^N\frac{1}{n^2}\sin^2(\pi x)\csc^2(\frac{\pi x}{n})$

I was looking for a closed form but it seemed too difficult. Now I'm seeking help to simplify this sum. The 50 bounty points or more will be awarded for any meaningful simplification of this sum.

I found this function that has very interesting property to show if $n \nmid x$. And the sum of this function from $2$ to $N$ can show all the primes within $N$ on 1, and primes beyond $n$ and within $N^2$ as zeros, and prime sieve beyond that $$f(n,x)=\frac{1}{n}F_n\left(\frac{2\pi}{n}x\right)=\frac{1}{n^2}\left(\frac{1-\cos(2\pi x)}{1-\cos\left(\frac{2\pi}{n}x\right)}\right)=\frac{1}{n^2}\left(\frac{\sin(\pi x)}{\sin\frac{\pi x}{n}}\right)^2$$ This is a prime test function and I try to find a closed form formula to simplify the calculation of $$\sum_{n=2}^Nf(n,x)=\sum_{n=2}^N\frac{1}{n^2}\left(\frac{\sin(\pi x)}{\sin\left(\frac{\pi x}{n}\right)}\right)^2=\sum_{n=2}^N\frac{1}{n^2}\sin^2(\pi x)\csc^2\left(\frac{\pi x}{n}\right)$$ Is there a close form formula (i.e. no or few terms of summation) for this sum? It's known that $$\int_{2}^{N} f(t,x)dt=\sin^2(\pi x)\int_{2}^{N}\frac{1}{t^2}\csc^2\left(\frac{\pi x}{t}\right)dt=\left. \left(\frac{1}{\pi x}\sin^2(\pi x)\cot\left(\frac{\pi x}{t}\right) \right)\right|_{t=2}^{t=N}$$ Does the Euler–Maclaurin Summation Formula help here?

Here's the example graphic of $\sum_{n=2}^{50}f(n,x)$ shows all primes within $2500$. • Here's reference to the Fejer Kernel function, the source of this formula. I created a variation here. en.wikipedia.org/wiki/Fej%C3%A9r_kernel – Fred Yang Apr 26 '16 at 16:00
• I'm not sure, but this might be solvable by finite calculus methods. See here and here. – G Pace May 2 '16 at 23:58
• @daniel Actually the input is all the natural numbers less than $N$ so you don't need to know primes less than $N$, and there're two parts. The part beyond $N$ is sieve by the primes less than $N$ as you said. More interesting part could be the part within $N$, where input of all natural numbers produces all primes on line 1, so when $N \rightarrow \infty$, this sum will produces all primes on line 1. – Fred Yang May 6 '16 at 6:24
• And probably you are right that this is close to a formula for the primes if there's such closed form expression exists. More precisely, this is a prime test function. – Fred Yang May 6 '16 at 6:31
• This is essentially the sieve of Eratosthenes, described in (for example) Halberstam's Sieve Methods in ch. 1. I don't think the use of trig sums changes this. Your sieve gives primes between $N$ and $N^2$. To locate more primes you need more terms. The transition from a sequence of finite sums to a hypothetical limiting expression in this context would amount to finding a formula for primes. As far as I know the existence of such a formula has not been demonstrated. – daniel May 6 '16 at 20:10

An idea:

Note the identity

$$\sin n \theta=U_{n-1}\left( \cos \theta \right) \sin \theta ,$$

where $U_i$ is the $i^{th}$ Chebyshev orthogonal polynomial of the second kind. This gives

$\sin^2 \pi x=\sin^2 \left(n \frac{\pi x}{n}\right)=U_{n-1}^2\left( \cos \frac{\pi x}{n} \right) \sin^2 \frac{\pi x}{n},$

and then

$\sin^2 \pi x \csc^2 \frac{\pi x}{n}=U_{n-1}^2\left( \cos \frac{\pi x}{n} \right) \sin^2 \frac{\pi x}{n} \csc^2 \frac{\pi x}{n}=U_{n-1}^2\left( \cos \frac{\pi x}{n} \right),$

$\sum \limits_{n=2}^N \frac{1}{n^2} U_{n-1}^2\left( \cos \frac{\pi x}{n} \right).$