# Proximity to perfect squares

Calculus Level 1

A function $f(n)$ is defined over positive integers as follows:

$f(n) = \begin{cases} 0 & \text{if }n\text{ is a perfect square}; \\ 1 & \text{if }n\text{ is closer to the perfect square before it than to the one after it}; \\ -1 & \text{otherwise}. \end{cases}$

For example, $f(1) = 0$ because 1 is a perfect square; $f(2) = 1$ because 2 is closer to 1 than it is to 4; $f(7) = -1$ because 7 is closer to 9 than it is to 4.

What can be said about the series $\displaystyle \sum_{n=1}^{\infty} \frac{f(n)}{n}?$

×