3. For each positive number, define the function $f(n)=\left\{\begin{array}{l}0, \text { when } n \text { is a perfect square, } \\ {\left[\frac{1}{\{\sqrt{n}\}}\right], \text { when } n \text { is not a perfect square, }}\end{array}\right.$ where $[x]$ is the greatest integer not exceeding $x$, $\{x\}=x-[x]$, find the value of $\sum_{k=1}^{240} f(k)$.
For any $n$ (where $n$ is not a perfect square), there exists $k$, such that $k^{2}\frac{30}{30}=1$, thus $f\left(15^{2}+a\right)=\left[\frac{\sqrt{15^{2}+a}+15}{a}\right]=1$. Therefore, $\sum_{k=1}^{240} f(k)=\sum_{k=1}^{256} f(k)-\sum_{k=241}^{256} f(k)=783-15=768$.