9
$\begingroup$

I'm trying to find a four-digit number that is equal to the product of (the sum of its digits) multiplied by (the square of the sum of the squares of its digits).

I've tried running all combinations in Python and found two solutions (2023 and 2400). However, my maths teacher gave it to me and said there was a way to solve it analytically.

$\sum_{i=0}^{3}10^{3-i}a_i = (\sum_{i=0}^{3} a_i) \times \left(\sum_{i=0}^{3} a_i^2\right)^2$

The only thing I found is that since $6^5 = 7776$, no $a_i$ for $i \in \{0, 1, 2, 3\}$ cannot be greater or equal than six because otherwise $a_0$ would be greater or equal than 7 and $7^5 > 10000$.

$\endgroup$
6
  • 1
    $\begingroup$ The equation you mentioned in your problem statement should be written as $$\sum_{i=0}^{3} 10^{3-i}a_i= \left(\sum_{i=0}^{3} a_i\right) \times \left(\sum_{i=0}^{3} a_i^2\right)^2.$$ Don’t you think so? $\endgroup$ Commented Mar 18, 2024 at 16:21
  • 3
    $\begingroup$ You can also show that $ a_0 + a_1 + a_2 + a_3 \leq 10$, which greatly reduces the number of cases to check. $\endgroup$ Commented Mar 18, 2024 at 16:49
  • $\begingroup$ @YNK yes sorry I was writing $a_0a_1a_2a_3$ not as the multiplication but as "putting them next to each other" which is obviously not rigorous $\endgroup$ Commented Mar 18, 2024 at 19:06
  • $\begingroup$ BTW it's pretty common to write $\overline{abcd}$ to mean $1000a+100b+10c+d$. $\endgroup$ Commented Mar 19, 2024 at 21:05
  • 2
    $\begingroup$ Personally, I think that it would be simpler to write the equation as $1000a + 100b + 10c + d = (a + b + c + d)(a^2 + b^2 + c^2 + d^2)^2$. $\endgroup$ Commented Mar 19, 2024 at 21:36

2 Answers 2

2
$\begingroup$

I’d look for the cases where the sum of digits times the square of the sum of digit squares is not too large.

Let the sum of digits be $s$, the sum of digit squares $S$, and $T=s \cdot S^2$. The sum of digit squares is smallest if the digits are as close to $\frac{s}{4}$ as possible.

  • $s=13$, then $S \geq3^2+3^2+3^2+4^2 = 43$, and $T \geq 24037$.
  • $s=12$ makes $S \geq 36$ and $T \geq 15552$.
  • $s=11$ makes $S \geq 31$ and $T \geq 10571$.
  • $s=10$ makes $S \geq 26$ and $T \geq 6760$. Because the digit sum of $T$ is only $10$, the first digit of $T$ is at least $7$, which makes $S \geq 7^2+1^2+1^2+1^2=52$. However, this makes $T$ too large, and so we can disregard this case.
  • $s=9$ makes $S \geq 21$ and $T \geq 3969$. Similarly, the first digit of $T$ is at least $4$, making $S \geq 25$ and $T \geq 5625$. Repeating this logic, we get the first digit of $T$ is at least $6$, making $S \geq 39$ and $T \geq 10000$.

Therefore, $s \leq 8$.

Additional Note: If we look at larger numbers with $k$ digits, $s \leq 9k$ and $S \leq 81k$, making $T \leq 59,049 k^3 < 10^{k-1}$ if $k \geq 9$.

$\endgroup$
2
  • $\begingroup$ I don't understand what the $k$ is referring to $\endgroup$ Commented Mar 18, 2024 at 19:11
  • 1
    $\begingroup$ @FluidMechanicsPotentialFlows k = number of digits if you don’t want to be restricted to four digit numbers. So the same problem for k digits instead of 4 digits has no solution if k >= 9. $\endgroup$ Commented Mar 19, 2024 at 21:42
2
+50
$\begingroup$

Here's a solution that ends up checking fewer than $30$ cases. I don't know if it would count as an analytic solution, but it's at least partly analytic.

Note that you don't need to approach this as a search through all 9000 four-digit numbers. Instead view it as a search through all sets of four digits $\{a,b,c,d\}$, seeing if $(a+b+c+d)(a^2+b^2+c^2+d^2)^2$ is some arrangement of those digits.

You established that no digit can be $7$ or higher. So not only is the number at most $9999$, it is at most $6666$. Suppose there is a $6$. Even $(6+0+0+0)(6^2+0^2+0^2+0^2)^2>6666$, so there is no $6$ either. So not only is the number at most $6666$, it is at most $5555$.

Suppose there is a $5$. But $(5+2+0+0)(5^2+2^2+0^2+0^2)^2>5555$ and $(5+1+1+1)(5^2+1^2+1^2+1^2)^2>5555$, and so the only possibilities with a $5$ are $\{5,1,1,0\}$ with $(5+1+1+0)(5^2+1^2+1^2+0^2)^2=5103$; $\{5,1,0,0\}$ with $(5+1+0+0)(5^2+1^2+0^2+0^2)^2=4056$; and $\{5,0,0,0\}$ with $(5+0+0+0)(5^2+0^2+0^2+0^2)^2=3125$. So there is no $5$.

So not only is the number at most $5555$, it is at most $4444$.

Meanwhile, consider if the sum of digits is $10$. The minimal value of $(a+b+c+d)(a^2+b^2+c^2+d^2)^2$ would come from making the digits as close together as possible: $\{3,3,2,2\}$. But $(3+3+2+2)(3^2+3^2+2^2+2^2)^2>4444$. So the sum of the digits is at most $9$.

Now that the digits are from $\{0,1,2,3,4\}$ and the sum must be at most $9$, there are not that many combinations left to check:

  • $\{4,4,*,*\}$ even with 0s, the result is more than $4444$.
  • $\{4,3,0,0\}$ gives $4375$
  • $\{4,3,*,*\}$ even with 1,0, the result is more than $4444$.
  • $\{4,2,0,0\}$ gives $2400$, a winner!
  • $\{4,2,1,0\}$ gives $3087$
  • $\{4,2,1,1\}$ gives $3872$
  • $\{4,2,2,*\}$ even with 0, the result is more than $4444$.
  • $\{4,1,0,0\}$ gives $1445$
  • $\{4,1,1,0\}$ gives $1944$
  • $\{4,1,1,1\}$ gives $2527$

Any further solutions have no $4$, so are at most $3333$. The sum of the digits now can be at most $8$.

  • $\{3,3,2,0\}$ gives $3827$
  • $\{3,3,1,1\}$ gives $3200$
  • $\{3,3,1,0\}$ gives $2527$
  • $\{3,3,0,0\}$ gives $1944$
  • $\{3,2,2,1\}$ gives $2592$
  • $\{3,2,2,0\}$ gives $2023$, a winner!
  • $\{3,2,1,1\}$ gives $1575$
  • $\{3,2,1,0\}$ gives $1176$
  • $\{3,2,0,0\}$ gives $845$
  • $\{3,1,*,*\}$ even with 1,1 is too small
  • $\{2,2,2,2\}$ gives $2048$
  • $\{2,2,2,1\}$ gives $1183$
  • $\{2,2,1,1\}$ gives $600$ and everything else to check is too small.
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.