This question was asked in an Iberoamerican Math Olympiad. I formed a conjecture that all numbers not equivalent to $3$ or $6$ $\mod 9$. But there are no squares with the sum of digits $2$. This is the only work from my side, any hints and help would be appreciated.

  • 3
    $\begingroup$ The only squares $\pmod 9$ are $0,1,4,7$ so any digit sum of a square would have to be one of those $\pmod 9$ $\endgroup$ – lulu Feb 2 '17 at 14:35
  • $\begingroup$ @lulu great observation! But how will one prove all numbers with these remainders are possible? $\endgroup$ – N.S.JOHN Feb 2 '17 at 14:40
  • $\begingroup$ No idea. Not even sure that every such integer can be the digit sum of a square, though that's certainly a natural guess. $\endgroup$ – lulu Feb 2 '17 at 14:44


$$9999999..9^2=9999..9800001 \\ 19999..9^2=3999..9600..01 \\ 29999...9^2=8999..94000..01 \\ 9999...95^2=9999..9000.025$$

Edit: Faster solution if $a$ is a digit, then $$(10^n-a)^2=10^{2n}-2a\times 10^n+a^2$$ Now $$10^{2n}-2a\times 10^n=999....9xy0000$$ where $xy=100-2a$. Now setting $a=1,2,5,9$ gives you exactly the formulas you want.


Consider a number $d$ greater than $9$. Then its $k{+}1$ digits $\{d_k,d_{k-1},\ldots, d_1, d_0\}$ represent the sum $\sum_0^k 10^i\cdot d_i$. The digit sum $s(d) = \sum_0^k d_i$ and the difference between them is $d-s(d) = \sum_0^k (10^i-1) d_i$. It is apparent that all the terms $(10^i-1)$ are divisible by $9$ and thus the remainder when divided by $9$ of $d$ and $s(d)$ is the same.

The digit sum can be iterated until the value is less than $10$, which I will show as $r(d)$. This value again has the same remainder as $d$ when divided by $9$, and for $r(d)<9$ it actually is the remainder.

Now consider $d^2$. Writing $d=9j+t$ with $t=r(d)$, we have $d^2 = 81j+18jt + t^2$. Now the first two terms are divisible by $9$, so to find $r(d^2)$ we only need to find $r(t^2)$.

But $t\in \{1,2,3,4,5,6,7,8,9\}$ so $t^2\in \{1,4,9,16,25,36,49,64,81\}$ and thus $r(d^2)=r(t^2) \in\{1,4,9,7,7,9,4,1,9\}=\{1,4,7,9\}$

There is also one special case: the digit sum of the perfect square $0$ is of course $0$.

Thus there are no repeated digit sums of squares that are any of $\{2,3,5,6,8\}$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.