# Are there numbers $N$ such that $N^2=n_1^2+n_2^2+\cdots+n_k^2+1$

In the past few hours I spent some time looking for numbers of the form $$N^2=n_1^2+n_2^2+\cdots+n_k^2+1$$ where $$n_i \gt 1 \wedge n_i \neq n_j \wedge k\ge 2$$ , and I found none. I searched up to $$100$$. I wonder if this kind of numbers exist at all...

So I came here for an answer. Can you provide some instances or rules to generate them, or on the contrary they simply can't exist for some reason.

Thanks.

Note that possible numbers are $$N^2=n_1^2+n_2^2+1$$ or $$N^2=n_1^2+n_2^2+n_3^2+1$$ etc... we can have any number of squares on the right side...

• How about $k=3$, $2^2 = 1^2 + 1^2 + 1^2 + 1$? Or are there some other requirements you haven't mentioned? Jun 11 '20 at 18:15
• No, $n_i\gt 1$, sorry. Jun 11 '20 at 18:17
• Extending @Robert Israel 's comment, letting $n_i=1$ does the trick for every $N\in \Bbb{N}$. If that's allowed. Jun 11 '20 at 18:17
• $11^2 = 2^2 + 4^2 + 10^2 + 1$ Jun 11 '20 at 18:18
• \eqalign{13^2 &= 2^2 + 8^2 + 10^2 + 1\cr 19^2 &= 2^2 + 10^2 + 16^2 + 1\cr 18^2 &= 3^2 + 5^2 + 17^2 + 1\cr 15^2 &= 4^2 + 8^2 + 12^2 + 1\cr 14^2 &= 5^2 + 7^2 + 11^2 + 1\cr 22^2 &= 5^2 + 13^2 + 17^2 + 1\cr 19^2 &= 8^2 + 10^2 + 14^2 + 1\cr 21^2 &= 10^2 + 12^2 + 14^2 + 1\cr} Jun 11 '20 at 18:21

By Lagrange's four-square theorem, any non-negative integer is a sum of at most four squares. If $$N^2-1$$ has a square factor $$m^2>1$$, as happens e.g. if $$N$$ is odd with $$m=2$$, write $$\frac{N^2-1}{m^2}=\sum_{i=1}^k\ell_i^2$$ so you can always do it with $$k\le4$$ viz. $$n_i=m\ell_i$$.

$$n^2=n1^2+n2^2+n3^2\tag{1}$$
Substitute $$n1=x, n2=b, n3=c, n=x+k$$ to equation $$(1).$$
We get $$x = 1/2\,{\frac {-{k}^{2}+{b}^{2}+{c}^{2}}{k}}$$
Thus, we get a parametric solution.

$$(n,n1,n2,n3) = (k^2+b^2+c^2, -k^2+b^2+c^2, 2bk, 2ck)$$

Choose (b,c,k) so that $$(n,n1,n2)$$ is divisible by $$n3$$, then
we get the solution of $$n^2=n1^2+n2^2+1$$.

                         [n, n1, n2, n3]
[3, 2, 2, 1]
[9, 8, 4, 1]
[19, 18, 6, 1]
[33, 32, 8, 1]
[51, 50, 10, 1]
[73, 72, 12, 1]
[99, 98, 14, 1]
[129, 128, 16, 1]
[163, 162, 18, 1]


After simple algebra, we get a parametric solution below.

$$(n,n1,n2,n3)=(1+2p^2, 2p^2, 2p, 1)$$
$$p$$ is arbitrary.

$$n^2=n1^2+n2^2+n3^2+n4^2\tag{2}$$
Substitute $$n1=x, n2=b, n3=c, n4=d, n=x+k$$ to equation $$(2).$$
Thus, we get a parametric solution.

$$(n,n1,n2,n3,n4) = (k^2+b^2+c^2+d^2, -k^2+b^2+c^2+d^2, 2bk, 2ck, 2dk)$$

Choose (b,c,d,k) so that $$(n,n1,n2,n3)$$ is divisible by $$n4$$, then
we get the solution of $$n^2=n1^2+n2^2+n3^2+1$$.

$$(n,n1,n2,n3,n4)=(1+2q^2+2p^2, 2q^2+2p^2, 2q, 2p, 1)$$
$$p,q$$ are arbitrary.