Sum of the series $\sum_{n\geq1} \frac{P(n) \bmod Q(n)} {n^2}$ I have asked earlier if the series $\sum_{n\geq1} \frac{2^n\bmod n} {n^2}$ is divergent. The definite answer has yet to come. I was wondering now about the easier case of $\sum_{n\geq1} \frac{P(n)\bmod Q(n)} {n^2}$  where the degree of $Q(n)$ is $1$. 
 A: Notice that
$$ P(n) \text{ mod } Q(n) = Q(n) \bigg\{ \frac{P(n)}{Q(n)} \bigg\} $$
From this, by multiplying $-1$ to both $P$ and $Q$ if needed, we may assume that the leading coefficient of $Q$ is positive. Also, since $\deg Q = 1$, we can write
$$ P(x) = A(x)Q(x) + B $$
for some polynomial $A(x)$ and some constant $B$. Thus
$$ \bigg\{ \frac{P(n)}{Q(n)} \bigg\} = \bigg\{ A(n) + \frac{B}{Q(n)} \bigg\}. $$
Now we consider several cases:


*

*Assume that the sequence $(A(n) : n \geq 1)$ takes integer values only. In particular, this forces that $A(x) \in \Bbb{Q}[x]$, and in fact, Pólya classified all such polynomials. Then for large $n$ we have $\{P(n)/Q(n)\} = B/Q(n)$. Thus in this case,
$$ \sum_{n=1}^{N} \frac{P(n) \text{ mod } Q(n)}{n^2} = \sum_{n=1}^{N} \frac{B}{n^2} + O(1) \quad \text{as } N \to \infty $$
and the summation converges.

*Assume that $(\{A(n)\} : n \geq 1)$ is periodic and $A(n) \notin \Bbb{Z}$ for some $n$. Then there exist positive integers $a, b \geq 1$ and sufficiently small $\epsilon > 0$ such that $ \{A(ak+b)\} \geq \epsilon. $ Then for large $k$ we have $\{ P(ak+b)/Q(ak+b)\} \geq \epsilon $ as well and thus
$$ \sum_{n=1}^{\infty} \frac{P(n) \text{ mod } Q(n)}{n^2}
\geq \sum_{k=1}^{\infty} \frac{P(ak+b) \text{ mod } Q(ak+b)}{(ak+b)^2}
\geq \epsilon \sum_{k=1}^{\infty} \frac{Q(ak+b)}{(ak+b)^2} + O(1). $$
Comparing the last term with the harmonic series, the summation diverges.

*Finally, assume that $(\{A(n)\} : n \geq 1)$ is never periodic. It can be proved that this happens exactly when the coefficient of some non-constant term of $A(x)$ is irrational. Now it is known that for such polynomial, $(\{A(n)\} : n \geq 1)$ is equidistributed. (See this.) Since $B/Q(n) \to 0$ as $n\to \infty$, it then follows that $\{ P(n)/Q(n) \}$ is also equidistributed. Thus by writing
$$ \sum_{n=1}^{\infty} \frac{P(n) \text{ mod } Q(n)}{n^2}
= \sum_{n=1}^{\infty} \frac{Q(n)}{n^2} \bigg\{ \frac{P(n)}{Q(n)} \bigg\}, $$
we can show that the series diverges. (Try summation by parts and compare the resulting summation with the harmonic series.)
Summarizing and utilizing Pólya's classification, we reach the following conclusion:

Conclusion. The series $\sum_{n=1}^{\infty} \frac{P(n) \text{ mod } Q(n)}{n^2}$ with $\deg Q = 1$ converges if and only if $P$ is of the form
  $$ P(x) = Q(x)\sum_{k=0}^{n} c_k \binom{x}{k} + B $$
  for some integers $c_k$ and a real number $B$.

A: Below is a partial answer, valid for the case when $Q$ is a monic polynomial (for simplicity, I shall take its leading coefficient to be $1$, but the proof is essentially the same for $-1$).
In order for your question to make sense, I shall assume $P$ and $Q$ with integer coefficients:
$$P = \sum _{i = 0} ^d a_i X^i, \quad Q = X - p .$$
Applying Euclidean division (this is where we use that $Q$ is monic, otherwise the division should be performed in $\Bbb Q[X]$ because $\Bbb Z[X]$ is not a Euclidean ring) to the polynomials $P$ and $Q$, there exist polynomials $F$ and $R$ in $\Bbb Z[X]$ such that
$$\tag{*} P = QF + R ,$$
with $\deg R < \deg Q = 1$ (which means that $R$ is in fact just an integer number).
Evaluating (*) in $p$ gives
$$P(p) = \underbrace {Q(p)} _{=0} F(p) + R = R .$$
Evaluating (*) in $n$ gives
$$P(n) = Q(n) F(n) + R = Q(n) F(n) + P(p) ,$$
which shows that
$$P(n) \mod Q(n) = P(p) \mod Q(n) .$$
Now, if $n$ is such that $P(p) < Q(n)$ (which means $n > p + P(p)$), then
$$P(p) \mod Q(n) = P(p) .$$
Putting all these together it follows that
$$\sum _{n = 1} ^\infty \frac {P(n) \mod Q(n)} {n^2} = \sum _{n = 1} ^\infty \frac {P(p) \mod Q(n)} {n^2} = \\
\sum _{n = 1} ^{P(p) + p - 1} \frac {P(p) \mod Q(n)} {n^2} + \sum _{n = P(p) + p} ^\infty \frac {P(p) \mod Q(n)} {n^2} = \\
\sum _{n = 1} ^{P(p) + p - 1} \frac {P(p) \mod Q(n)} {n^2} + \sum _{n = P(p) + p} ^\infty \frac {P(p)} {n^2} .$$
The first part of the last line is just a sum with a finite number of terms, therefore finite, and the second is a convergent series, essentially because $\sum  \limits _{n = 1} ^\infty \dfrac 1 {n^2}$ is well known to be convergent.
