4
$\begingroup$

Consider a four digit number $\overline{abcd}$ such that $$(\overline{ab})^2+(\overline{bc})^2+(\overline{cd})^2=\overline{abcd} $$ $\overline{ab}$, $\overline{bc}$ and $\overline{cd}$ are two digit numbers

What is this number ?

What I have tried is

$$(10a+b)^2+(10b+c)^2+(10c+d)^2=\overline{abcd} $$ then I used $(a+b)^2$ formula but this method didn't help.

I need mathematical solution

$\endgroup$
11
  • 1
    $\begingroup$ When they say a four digit number, $abcd$ also means $1000a+ 100b+10c+d$ $\endgroup$
    – Will Jagy
    Jan 2, 2021 at 20:41
  • $\begingroup$ @WillJagy Yes sir $\endgroup$ Jan 2, 2021 at 20:42
  • $\begingroup$ I've found the solution by brute force. $\endgroup$ Jan 2, 2021 at 20:43
  • $\begingroup$ @Gribouillis Can you please tell me how you did it ? $\endgroup$ Jan 2, 2021 at 20:44
  • 1
    $\begingroup$ @JalilAhmad Your starting was pretty good. You should solve $$(10 a+b)^2+(10 b+c)^2+(10 c+d)^2=1000 a+100 b+10 c+d$$ $\endgroup$
    – Raffaele
    Jan 2, 2021 at 21:05

5 Answers 5

1
$\begingroup$

Not a 'real' answer, but it was too big for a comment. I think that you're looking for a solution without using a calculator or PC but maybe this gives some insight. I did a quick search where I look for values that can be written as $1000\text{a}+100\text{b}+10\text{c}+\text{d}$ where $\left\{\text{a},...,\text{d}\right\}\in\left\{1,...,9\right\}$

I wrote and ran some Mathematica-code:

In[1]:=Clear["Global`*"];
ParallelTable[
  If[TrueQ[1000*a + 100*b + 10*c + 
      1*d == (a*b)^2 + (b*c)^2 + (c*d)^2], 
   1000*a + 100*b + 10*c + 1*d, Nothing], {a, 1, 9}, {b, 1, 9}, {c, 1,
    9}, {d, 1, 9}] //. {} -> Nothing

Running the code gives:

Out[1]={{{{1284}}}}

Because:

$$\left(1\cdot2\right)^2+\left(2\cdot8\right)^2+\left(8\cdot4\right)^2=1284\tag1$$

That is the only four digit number with that property.


If you mean that two digit number thing, I got:

In[2]:=Clear["Global`*"];
ParallelTable[
  If[TrueQ[1000*a + 100*b + 10*c + 
      1*d == (a*10 + b)^2 + (b*10 + c)^2 + (c*10 + d)^2], 
   1000*a + 100*b + 10*c + 1*d, Nothing], {a, 1, 9}, {b, 1, 9}, {c, 1,
    9}, {d, 1, 9}] //. {} -> Nothing

Out[2]={{{{3334}}}}

Because:

$$\left(10\cdot3+3\right)^2+\left(10\cdot3+3\right)^2+\left(10\cdot3+4\right)^2=3334\tag2$$

That is the only four digit number with that property.

$\endgroup$
4
  • 2
    $\begingroup$ it should be $12^2+28^2+84^2 = 1284$. which is wrong $\endgroup$
    – Aven Desta
    Jan 2, 2021 at 20:57
  • $\begingroup$ @AvenDesta see my edit $\endgroup$ Jan 2, 2021 at 20:58
  • $\begingroup$ It could be done in a simpler way using Mathematica. Look at my answer $\endgroup$
    – Raffaele
    Jan 2, 2021 at 21:08
  • $\begingroup$ Technically the ranges for $b$, $c$, and $d$ should be $0 \leftrightarrow 9$, but that doesn't change the result. $\endgroup$ Jan 2, 2021 at 22:24
1
$\begingroup$

Denote $S = (\overline{bc})^2+(\overline{cd})^2$. Note that $S < 3500$ — otherwise, we have $a \geq 3$, therefore $\overline{abcd} \geq 3500 + 900 = 4300$, so $a \geq 4$, and if we continue we reach a contradiction.

In particular, this implies $b, c < 6$.

Taking our original equation mod 10, we obtain $$b^2 + c^2 + d^2 \equiv d \pmod{10}$$ $$b^2 + c^2 \equiv - d(d-1) \pmod{10}$$

Checking each value of $d$ separately, we see that the right side can only have values 0, 4, and 8. Similarily, considering the quadratic residues mod 10 (all of which happen to be reachable with $b, c < 6$), you'll find five possible pairs for $\{b, c\}$:

  • 3, 1
  • 3, 3
  • 3, 5 (which can be eliminated with the $S < 3400$ condition)
  • 2, 0 (which violates the condition that the numbers being squared should have two digits)
  • 2, 4
  • 2, 2

Each of those also has a small subset of possible values of $d$.

While this gets us near the threshold where checking the cases by hand becomes possible, I personally wouldn't want to do that.

I'd try finding a lower bound for $S$, to complement or upper bound of 3400 and help prune some of these possibilities.

$\endgroup$
2
  • 1
    $\begingroup$ 3400+2500=5900, so how do you exclude a=5? I think S<3500 is more appropriate. $\endgroup$
    – miracle173
    Dec 16, 2021 at 7:10
  • $\begingroup$ why do you exclude 2,2 for b,c? $\endgroup$
    – miracle173
    Dec 17, 2021 at 0:05
0
$\begingroup$

It's not a pretty answer, but here is a brute-force solution in Python

>>> from itertools import product
>>> digits = '0123456789'
>>> for a,b,c,d in product(digits, digits, digits, digits):
...     if int(a+b)**2 + int(b+c)**2 + int(c+d)**2 == int(a+b+c+d):
...         print(a + b + c + d)
... 
0000
0001
3334
$\endgroup$
6
  • $\begingroup$ You've got it wrong, it's not $a+b$ but $\overline{ab}$ (i.e. digit concatenation). $\endgroup$ Jan 2, 2021 at 20:50
  • 1
    $\begingroup$ @ParclyTaxel I'm not adding numbers but strings of characters, hence '3' + '3' = '33' $\endgroup$ Jan 2, 2021 at 20:51
  • 1
    $\begingroup$ Then why does the other answer say only $1284$? $\endgroup$ Jan 2, 2021 at 20:54
  • 1
    $\begingroup$ @ParclyTaxel because they solve another problem by interpreting $ab$ as $a\times b$ instead of $10 a + b$. $\endgroup$ Jan 2, 2021 at 20:55
  • 2
    $\begingroup$ @Derik, it works because you it should be $33^2$ not $(3\cdot 3)^2$ $\endgroup$
    – Aven Desta
    Jan 2, 2021 at 20:56
0
$\begingroup$

It could be done in a simpler way using Mathematica

FindInstance[(10 a+b)^2+(10 b+c)^2+(10 c+d)^2==1000 a+100 b+10c+d
 &&0<a<10&&0<b<10&&0<c<10&&0<d<10,{a,b,c,d},Integers,2]

and get $$\{\{a\to 3,b\to 3,c\to 3,d\to 4\}\}$$ the number is $3334$.

$\endgroup$
2
  • $\begingroup$ Sir I need mathematical solution $\endgroup$ Jan 2, 2021 at 21:09
  • $\begingroup$ @JalilAhmad i have no idea how to solve $$100 a^2+20 a b+101 b^2+20 b c+101 c^2+20 c d+d^2=1000 a+100 b+10 c+d$$ If you find a solution, let me know $\endgroup$
    – Raffaele
    Jan 2, 2021 at 21:12
0
$\begingroup$

This is the same idea as presented in NieDzejkob's post. But the proof was incompletes an contains as far as I can see some errors so I present my complete answer here.

We look for a four digit number such that $${\overline{ab}}^2+{\overline{bc}}^2+{\overline{cd}}^2=\overline{abcd}$$ which means that

$$(10a+b)^2+(10b+c)^2+(10c+d)^2\\=1000a+100b+10c+d, \\ a,b,c,d\in\{0,1,2,\ldots,9\} \tag {1.1}$$ or $$100(a^2+b^2+c^2)+20(ab+bc+cd)+(b^2+c^2+d^2)\\=1000a+100b+10c+d, \\ a,b,c,d\in\{0,1,2,\ldots,9\} \tag{1.2}$$

Maybe one wants to assume that leading digits should not be $0$ but we will not do this.

If $a=n$ then a lower bound $\overline {abcd}$ is $1000n$ and an upper bound is $1000(n+1)$. A lower bound for $(\overline{ab})^2$ is $(10n)^2$ and an upper bound is $(10(n+1))^2$. Note that $$\overline {abcd}-(\overline{ab})^2=(\overline{bc})^2+(\overline{cd})^2$$ So a lower bound for ${\overline{bc}}^2+{\overline{cd}}^2$ is

$$\text{lower}\left({\overline{bc}}^2+{\overline{cd}}^2\right):=\max(1000n-(10(n+1))^2,0)\tag{2.1}$$

and an upper bound is

$$\text{upper}\left({\overline{bc}}^2+{\overline{cd}}^2\right):=\min(1000(n+1)-(10n)^2)\tag{2.2}$$

From this we construct the following table

\begin{array}{|r||r||r|} \tag{Table 1} \hline a&\text{lower}\left({\overline{bc}}^2+{\overline{cd}}^2\right)&\text{upper}\left({\overline{bc}}^2+{\overline{cd}}^2\right)\\ \hline 0&0&1000\\ \hline 1& 600& 1900\\ \hline 2& 1100& 2600\\ \hline 3& 1400& 3100\\ \hline 4& 1500& 3400\\ \hline 5& 1400& 3500\\ \hline 6& 1100& 3400\\ \hline 7& 600& 3100\\ \hline 8& 0& 2600\\ \hline 9& 0& 1900\\ \hline \end{array}

We conclude $$b,c \le 5 \tag 2$$ From $(1.2)$ we get the modulo $2$ equation

$$b^2+c^2+d^2\equiv d \pmod 2$$ and further $$b\equiv c \pmod 2 \tag 3$$

$(2)$ and $(3)$ gives $$ b,c \in \{0,2,4\} \tag{4.1}$$ or $$ b,c \in \{1,3,5\} \tag{4.2}$$

From $(1.2)$ we get also the modulo $5$ equation

$$b^2+c^2\equiv d-d^2 \pmod 5\tag 5$$

The expression $d-d^2 \pmod 5$ can have the following values

\begin{array}{|r||r|}\tag{Table 2} \hline d& d-d^2\mod 5\\ \hline 0 & 0 \\ \hline 1 & 0 \\ \hline 2 & 3 \\ \hline 3 & 4 \\ \hline 4 & 3 \\ \hline \end{array}

we rearrange the table

\begin{array}{|r||r|}\tag{Table 3} \hline b^2+c^2 \pmod 5 & d\\ \hline 0 & 0,1,5,6 \\ \hline 1 & -\\ \hline 2 & - \\ \hline 3 & 2,4,7,9 \\ \hline 4 & 3,8 \\ \hline \end{array}

From this we get

\begin{array}{|r||r|}\tag{Table 4} \hline \{b,c\} & \text{possible}\; d\\ \hline \{0\} & 0,1,5,6\\ \hline \{0,2\} & 3,8 \\ \hline \{0,4\} & - \\ \hline \{2\} & 2,4,7,9 \\ \hline \{2,4\} & 0,1,5,6 \\ \hline \{4\} &- \\ \hline \{1\} &- \\ \hline \{1,3\} & 0,1,5,6 \\ \hline \{1,5\} &- \\ \hline \{3\} &2,4,7,9 \\ \hline \{3,5\} &3,8 \\ \hline \{5\} & 0,1,5,6 \\ \hline \end{array}

The last line of this table can be removed because if $b=5,c=b$ then ${\overline {bc}}^2+{\overline {cd}}^2 \ge 5000$, which contradicts $\text{Table } 1$.

From equation $(1.2)$ we get

$$b^2+c^2+d^2 \equiv 10c+d \pmod {20}$$ and further $$b^2+c^2+10c \equiv -d^2 +d \pmod {20} \tag 6$$ and use this to filter our impossible values from $\text{Table } 4$

We note that

\begin{array}{|r||r|}\tag{Table 5} \hline b^2+c^2 \pmod 5 & d\\ \hline 0 & 0,1,5 \\ \hline 1 & -\\ \hline 2 & - \\ \hline 4 & 3,8 \\ \hline 8 & 4,9 \\ \hline \end{array}

and reduce $\text{Table } 4 $ to

\begin{array}{|r||r|}\tag{Table 6} \hline \{b,c\} &b^2+c^2+10c &\text{possible}\; d\\ \hline \{0\} & 0& 0,1,5\\ \hline \{0,2\} & 4 & 8 \\ \hline \{2\} & 8 & 4,9 \\ \hline \{2,4\} & 0& 0,1,5 \\ \hline \{1,3\}& 0 & 0,1,5 \\ \hline \{3\} & 8 &4,9 \\ \hline \{3,5\} & 4&8 \\ \hline \end{array}

These are $23$ tuples.

From $(1.2)$ we get

$$a=\frac{50-b}{10}\pm\sqrt{\frac{-{{d}^{2}}+\left( 1-20 c\right) d-101 {{c}^{2}}+\left( 10-20 b\right) c-100 {{b}^{2}}+2500}{100}}\tag{6}$$

The discriminant (this is expression under the square root) must be a perfect square. The calculation of the discriminant seems to be a little bit cumbersome without the usage of a calculator. But if a number is a perfect square it has a square root modulo every module $m$. So we reduce this table by checking if the discriminant has a square root modulo $9$ and if this is the case we check further it it has a square root modulo $11$. The calculation with these moduli is simple because we have to calculate only with one digit numbers except for $10 \pmod{11}$.

The discriminant modulo $9$ is

$$( 1-2 c-d) d+( 1-2 b-2c) c-b^2-2$$

Modulo $11$ it is

$$( 1+2 c -d) d+( 2 b-1-2c) c-b^2+3$$

From this we create $\text{Table 7}$. $r_9$ is the discriminant modulo $9$. I the root exists, this is if $r_9 \in \{0,1,4,7\}$ then we also calculate $r_{11}$, the discriminant modulo $11$. If the root modulo $11$ exists we finally solve the quadratic equation modulo $9$ and $11$. We have

$$a=5-b\pm \sqrt{( 1-2 c-d) d+( 1-2 b-2c) c-b^2-2}\pmod 9$$

and

$$a=5+b\pm \sqrt{( 1+2 c -d) d+( 2 b-1-2c) c-b^2+3} \pmod {11}$$

We add $9$ to the possible solutions modulo $9$ if if contains $0$ because $0\equiv 9 \pmod 9$. This is the column $a_9$. We remove $10$ from the possible solutions modulo $11$, because $10$ is not a digit. This is the column $a_{11}$.

We get the following table the following table:

\begin{array}{|r||r|}\tag{Table 7} \hline b&c&d&r_9&r_{11}&a_9&a_{11} \\ \hline 0 & 0 & 0 & 7 & 3 & 0, 1, 9 & 0 \\ \hline 0 & 0 & 1 & 7 & 3 & 0, 1, 9 & 0 \\ \hline 0 & 0 & 5 & 5 \\ \hline 0 & 2 & 8 & 3 \\ \hline 1 & 3 & 0 & 3 \\ \hline 1 & 3 & 1 & 6 \\ \hline 1 & 3 & 5 & 7 & 8 \\ \hline 2 & 0 & 8 & 1 & 9 & 2, 4 & 4 \\ \hline 2 & 2 & 4 & 6 \\ \hline 2 & 2 & 9 & 7 & 5 & 7, 8 & 0, 3 \\ \hline 2 & 4 & 0 & 4 & 1 & 1, 5 & 6, 8 \\ \hline 2 & 4 & 1 & 5 \\ \hline 2 & 4 & 5 & 7 & 10 \\ \hline 3 & 1 & 0 & 0 & 8 \\ \hline 3 & 1 & 1 & 7 & 10 \\ \hline 3 & 1 & 5 & 6 \\ \hline 3 & 3 & 4 & 1 & 3 & 1, 3 & 2, 3 \\ \hline 3 & 3 & 9 & 1 & 6 \\ \hline 4 & 2 & 0 & 5 \\ \hline 4 & 2 & 1 & 1 & 8 \\ \hline 4 & 2 & 5 & 1 & 4 & 0, 2, 9 & 0, 7 \\ \hline \end{array}

The Chinese Remainder Theorem tells us that for each tuple $b,c,d$ each element of $a_9$ can be combined with an element of $a_{11}$ and that gives us an element $a$ of $\mathbb {Z_{99}}$ that is a solution of the equation $\pmod{99}$. But we are only interested in value $a$ that are in $0,1,2,\ldots,9$. This is only the case if the number is in $a_9$ and $a_{11}$.

\begin{array}{|r||r|}\tag{Table 8} \hline b&c&d&a \\ \hline 0 & 0 & 0 & 0 \\ \hline 0 & 0 & 1 & 0 \\ \hline 2 & 0 & 8 & 4 \\ \hline 3 & 3 & 4 & 3 \\ \hline 4 & 2 & 5 & 0 \\ \hline \end{array}

But it is still not guaranteed that such a tuple is a solution because the discriminant may not be a perfect square and therefore the root may not exist in $\mathbb Z$. So we have to check $(1.1)$ for each of these possible solutions and find

$$0000=00^2+00^2+00^2$$ $$0001=00^2+00^2+01^2$$ and finally $$3334=33^2+33^2+34^2$$


Faster and shorter in Python:

for n in range(10000):
    s=('0000'+str(n))[-4:]
    if int(s[:2])**2+int(s[1:3])**2+int(s[2:])**2==n:
        print(n)

Output

0
1
3334
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .