# Is there a 2019-digit number such that the sum of squares of its digits is a square number?

Is there a number with $$2019$$ digits, all digits are positive, such that the sum of squares of its digits is a square number ?

The case is clear if the number has $$n^2$$ digits. Since $$n^2\cdot(3^2+4^2)=n^2\cdot5^2$$ is a square number, we can take the number $$33\dots344\dots4$$, where $$3$$ and $$4$$ appeared $$n^2$$ times, to see that exists a number with that property for every $$2n^2$$-digit number. and for others cases I made some progress, but I could not figue out the case $$n=2019=3\cdot673$$. I can't see why it would't exist.

• Also, just choosing all 1s works for $n^2$ digits. – RghtHndSd Nov 11 '19 at 22:10
• @RghtHndSd. Sure. I think this is the meaning of "The case is clear." The next sentence is to justify the $2n^2$ digits case. – Mason Nov 11 '19 at 22:17
• Is there any length that this is not possible for? $9, 43, 632, 1111, 32111, 211111, 5421111, 44443333, \dots$ – Mason Nov 11 '19 at 22:29

Let $$a$$ count the number of $$1$$'s in your $$2019$$-digit number, $$b$$ the number of $$2$$'s, $$c$$ the number of $$3$$'s, etc., up to $$h$$ the number of $$8$$'s and $$k$$ the number of $$9$$'s. Then the sum of the squares of the digits is

$$a+4b+9c+16d+25e+36f+49g+64h+81k$$

with

$$a+b+c+d+e+f+g+h+k=2019$$

So all we need is for

$$2019+3b+8c+15d+24e+35f+48g+63h+80k$$

to be a square with $$b+c+d+e+f+g+h+k\le2019$$

Since $$2019+3\cdot2=2025=45^2$$, and since non-negative combinations of $$3b+8c$$ form every integer greater than $$13$$ all by themselves, you have to go pretty high up to find a square that is not expressible as the sum of the squares of $$2019$$ nonzero digits. It might be of interest to find the first square that gets missed.

• The first square you miss is $1$. The second is $4$... – Misha Lavrov Nov 11 '19 at 23:27
• @MishaLavrov, I thought it was clear from context I meant the first large square (greater than $44^2=1936$, to be precise). – Barry Cipra Nov 11 '19 at 23:33
• What's great about this answer is that it explains exactly how teachers come up with infinitely many questions which change each academic year, and students who understand how to approach the problem from a mathematical point of view can then solve all of them (rather than guessing a solution and verifying, or worse: bruteforce approach). – Asaf Karagila Nov 12 '19 at 7:51

$$2015\cdot1^2+5^2+7^2+2^2+4^2=2116=46^2$$

Note that $$45^2 = 2025$$ and $$2017(1^2) + 2(2^2) = 2025$$.

In general, this will work for a lot of numbers, because, by changing say $$n$$ $$1$$'s to $$2$$'s and $$m$$ $$1$$'s to $$3$$'s, we can add $$3n + 8m$$ to our number. Setting $$m$$ and $$n$$ to whatever gives us a lot of possibilities

Since I saw answers with sum of digits squared $$45^2$$ and $$46^2$$,

I found $$47^2=2015\cdot1^2+4^2+4^2+9^2+9^2$$

Try $$(10^{2019}-1)/9+11$$. Can you identify which number squared is the digital sum for this case?