Find all four digit positive integers such that the sum of the squares of the digits equals twice the sum of the digits.
Problem
Source: Mexico 2023/1
Tags: number theory
08.11.2023 21:47
Let $N = \overline{a_3a_2a_1a_0}$ be a four digit number satisfying $(1) \;\; \sum_{i=0}^3 a_i^2 = 2 \sum_{i=0}^3 a_i$. Equation (1) is equivalent to $(2) \;\; \sum_{i=0}^3 (a_i - 1)^2 = 4$. Let us consider the following three cases: Case 1: $a_3 \geq 3$. Then $a_3 - 1 \geq 2$, yielding $N=3000$ by equation (2). Case 2: $a_3=2$. Therefore by equation (2) $\sum_{i=0}^2 (a_i - 1)^2 = 3$, which implies $|a_i - 1| = 1$, i.e. $a_i \in \{0,2\}$ for $i \in \{0,1,2\}$. Hence equation (1) has $2^3 = 8$ solutions. Case 3: $a_3=1$. Consequently by equation (2) $\sum_{i=0}^2 (a_i - 1)^2 = 4$, yielding $a_k=3$ and $a_i=1$ by equation (2), where $0 \leq i,k \leq 2$ and $i \neq k$. In other words is $N \in \{1113, 1131,1311\}$. Conclusion: The number $T$ of four digit numbers $N$ satisfying equation (1) is $T = 1 + 8 + 3 = 12$.
14.11.2023 19:48
Note that the first solution should be $3111$ instead of $3000$ (of course everything is symmetric under permutation of the digits, and you already have $1311, 1131, 1113$).