Sum Cool Squares.

There exists two 4-digit numbers a b c d \overline{abcd} such that a b 2 + c d 2 = a b c d . \overline{ab} ^{2} + \overline{cd} ^{2} = \overline{abcd}. What is the sum of those two numbers?

Note:
a , b , c , d {a,b,c,d} are digits, not factors of a product.
a 0 a \neq 0 .
Also, this problem is not original.


The answer is 10066.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

6 solutions

First, let x = a b x = \overline{ab} and let y = c d y = \overline{cd} . a b c d \overline{abcd} then becomes 100 x + y 100x+y , so the equation of interest is

x 2 + y 2 = 100 x + y x^{2}+y^{2}=100x+y

Now let's complete the square: 4 x 2 + 4 y 2 = 400 x + 4 y 4x^{2}+4y^{2}=400x+4y 4 x 2 + 4 y 2 400 x 4 y = 0 4x^{2}+4y^{2}-400x-4y=0 4 x 2 400 x + 10000 + 4 y 2 4 y + 1 = 10001 4x^{2}-400x+10000+4y^{2}-4y+1=10001 ( 2 x 100 ) 2 + ( 2 y 1 ) 2 = 10001 (2x-100)^{2}+(2y-1)^{2}=10001

So the problem comes down finding a pair of numbers (a,b) such that the sum of the squares is 10001. One such pair is (100, 1), but that pair does not yield any values of x and y within the range 10-99. The other, less obvious pair is (76,65). Setting 2 x 100 = 76 2x-100=76 yields x = 88, while setting 2 y 1 = 65 2y-1=65 yields y = 33. So one of the desired 4-digit numbers is 8833 8833 .

To find the other, note that the fact that 7 6 2 + 6 5 2 = 10001 76^{2}+65^{2}=10001 holds true even if we take 76 and/or 65 to be negative. So let's solve for x and y again. 2 x 100 = 76 2x-100=-76 yields x = 12, while 2 y 1 = 65 2y-1=-65 yields y = -32. Clearly y = -32 doesn't work, so we can just use y = 33 again. This yields the other desired 4-digit number, 1233 1233 .

And of course, 8833 + 1233 = 10066 8833+1233=\boxed{10066}

I have a doubt. How will you find ( a , b ) (a,b) without using a calculator??

Mohammed Imran - 1 year, 2 months ago
Shreya R
Mar 28, 2015
1
2
3
4
5
6
7
8
9
    s=0    
    for a in range(1,10):
         for b in range(1,10):
            for c in range(1,10):
                for d in range(1,10):
                   x=1000*a+100*b+10*c+d
                   if (((10*a+b)**2+(10*c+d)**2)==x):
                                  s=s+x
     print(s) 

The following python code gives the required solution = 10066 \boxed{10066}

David Holcer
Mar 18, 2015
1
2
3
4
5
6
7
summ=0
for i in range(10,100):
    for j in range(10,100):
        abcd=1000*int(str(i)[0])+100*int(str(i)[1])+10*int(str(j)[0])+int(str(j)[1])
        if i**2+j**2==abcd:
            summ+=abcd
print summ

Shreyas Shastry
Mar 15, 2015

{ for(i=1000;i<=9999;i++) {

            int k=i%100;
            sum=(k*k);
            j=i/100;
            a=(j*j);
        b=sum+a;
            if(b==i)
                 { 
                       System.out.println(i);
                 }
        }

the numbers are found to be 1233 and 8833 so sum=(1233+8833)=10066

Mohammed Imran
Mar 27, 2020

The answer is 10066.

Substituting a b = x \overline{ab}=x and c d = y \overline{cd}=y we have a b c d = 100 x + y \overline{abcd}=100x+y . Writing our equation in terms of x x and y y , we have x 2 + y 2 = 100 x + y x^2+y^2=100x+y making a quadratic in x x , we have x 2 100 x + ( y 2 y ) = 0 x^2-100x+(y^2-y)=0 since x x and y y are positive integers, the discriminant must be a perfect square. So, 10000 4 y 2 + 4 y 10000-4y^2+4y must be a perfect square. This implies that this expression must not end in 2 , 3 , 7 , 8 2,3,7,8 . This implies that y y must not end in 1 , 7 , 4 , 9 , 2 1,7,4,9,2 . Also, since 10000 > 4 y 2 4 y , y < 50 10000 > 4y^2-4y, y<50 . Now this problem is a lot easier. We will move forward to make it simpler. Let y y end in 6 6 . Then, the term 4 y 2 4 y 4y^2-4y will end in only one zero. But, a perfect square cannot end in an odd number of zeros. So, y y should not end in 6 6 also. Similarly, for 5 5 the only value where 4 y 2 4 y 4y^2-4y will end in two zeros is y = 25 y=25 , but that will not give 10000 4 y 2 + 4 y 10000-4y^2+4y to be a perfect square. So, y y must not end in 5 5 also. Now, y y can end in only 3 3 and 8 8 . Also, y y starting digit can be at max 4 4 . So, we have only 8 numbers to case-bash. And hence, we will finally get y = 33 y=33 which gives x = 88 ( o r ) 12 x=88(or)12 . So, the sum of the two numbers is 1233 + 8833 = 10066 1233+8833=\boxed{10066}

I hope you like the method!!!

Brock Brown
Mar 28, 2015

Python 2.7:

1
2
3
4
5
6
7
8
def goal(n):
    number = str(n)
    return n == int(number[0:2])**2 + int(number[2:4])**2
total = 0
for n in xrange(1000,10000):
    if goal(n):
        total += n
print "Answer:", total

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...