On a recent assignment, I (wrongly) wrote off that $$\int_0^{2\pi}\sin(x)dx =0 \implies \int_0^{2\pi}\sin^3(x) dx = 0$$ Though the result is not wrong, the integral of $f(x)$ over an interval being $0$ does not force the integral of $[f(x)]^3$ over that same interval to be $0$.
I came up with a related functional equation I cannot find any non-trivial solutions for:
$$\sum_{n=1}^\infty f(n)=\sum_{n=1}^\infty [f(n)]^2$$
Additionally, I wonder what other non-constant functions satisfy
$$\sum_{n=1}^\infty f(n)=\sum_{n=1}^\infty [f(n)]^k$$
for other $k>2$.
Edit: I changed the exponent from $3$ to $2$ because I realized there are a large number of pretty easily-obtained solutions in the case where $k=3$.
Let $g$ be any function such that $$\sum_{n=1}^\infty g(n) \text{ and } \sum_{n=1}^\infty [g(n)]^2$$ both converge.
Let $$\sum_{n=1}^\infty g(n)=A \text{ and } \sum_{n=1}^\infty [g(n)]^2=B$$ then $f(x)=\frac{A}{B}g(x)$ satisfies the required equation.
Similarly, you can obtain solutions for other powers.