1

My question is about the following problem:

Given some $n\in\mathbb{N}$, is $n$ a sum of squares of consecutive (nonnegative) integers (i.e. are there $r,s\in\mathbb{N}$ such that $n=\sum_{i=r}^si^2$)?

Is there an elegant, yet somehow elementary way to do this (in particular other than exhaustively trying values $(r,s)$ for some given $n$, or trying values for $r$ and solving for $s$)?

If there should be no such solution in general, what could be ideas that help with concrete examples? For example, $2018 = \sum_{i=7}^{18}i^2$. Could one get to this result using techniques from, say, an introductory lecture in algebra and elementary number theroy, without exhaustively testing values for either $r$ or $(r,s)$ (in notation from above)?

Any help is highly appreciated. Thanks in advance!

user103697
  • 537
  • 2
  • 7
  • Is $2$ the sum of consecutive squares? Are you asking for a characterization of the integers that are/aren't? – lulu Feb 14 '18 at 13:55
  • 1
    By the Faulhaber formula, such a sum can be written as

    $$\frac{p(p+1)(2p+1)-q(q+1)(2q+1)}6=\frac{(2p^2+2pq+2q^2+3p+3q+1)(p-q)}6$$

    –  Feb 14 '18 at 13:58
  • @lulu Yes, a characerization would be great! Ideally in such a way that the values for $r$ and $s$ are obtained along with a positive answer... – user103697 Feb 14 '18 at 14:03
  • @lulu Still, also techniques helping with a concrete example like 2018 would be very helpful – user103697 Feb 14 '18 at 14:03
  • @YvesDaoust Thank you for your hint! I came across this formula while thinking about the problem, but how to find out if this one (set equal to $n$) has solutions $(p,q)\in\mathbb{N}^2$? – user103697 Feb 14 '18 at 14:05
  • @lulu $2$ should not be a sum of consecutive squares in this sense... – user103697 Feb 14 '18 at 14:07

1 Answers1

0

A characterization is available for $n$ being a square:

When is a sum of consecutive squares equal to a square?

Also, OEIS A001422 gives the full list of natural numbers not expressible as the sum of distinct squares at all: $$ \begin{array}{c} 2, 3, 6, 7, 8, 11, 12, 15, 18, 19, 22, 23, 24, 27, 28, 31, 32, 33, \\ 43, 44, 47, 48, 60, 67, 72, 76, 92, 96, 108, 112, 128. \end{array} $$ So all numbers $n\ge 129$ are a sum of distinct squares. A similar result might be true for consecutive squares; related literature is given in the article On Integers which are are representable as sums of large consecutive squares and the references therein.

Dietrich Burde
  • 130,978