When watching a gaming video, I noticed an intriguing fact:
$$ 1 \times 1 + 2 \times 2 + 3 \times 4 + 4 \times 8 = 49, $$
which is a square number.
I asked myself, is this a coincidence or not? Specifically, is $g(k):=\sum_{i=0}^k(i+1)2^i$ a square only for $k=0,3$? Numerical experiments up to $k=65928$ suggests that this is the case. How can I prove this?
A solution, or a source, or an idea why this might be hard, are all welcome.
The inspiration can be found early in this video (timestamp 0:22 - 0:33).
Yes, $k = 0, 3$ are the only values $k$ that give squares.
Hint The summands form an arithmetico-geometric sequence and so the sum can be written in closed form as $$g(k) := \sum_{i = 0}^k (i + 1) 2^i = 2^{k + 1} k + 1$$ (see OEIS A000337). We are thus looking for solutions $(n, k)$ in nonnegative integers of the closed-form equation $$2^{k + 1} k + 1 = n^2 .$$ Since the left-hand side is odd, $n$ must be also odd, say, $n = 2 m + 1$ for some integer $m$, and substituting and rearranging gives the equation $$2^{k - 1} k = (m + 1) m .$$