There exists two 4-digit numbers a b c d such that a b 2 + c d 2 = a b c d . What is the sum of those two numbers?
Note:
a
,
b
,
c
,
d
are digits, not factors of a product.
a
=
0
.
Also, this problem is not original.
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.
I have a doubt. How will you find ( a , b ) without using a calculator??
1 2 3 4 5 6 7 8 9 |
|
The following python code gives the required solution = 1 0 0 6 6
1 2 3 4 5 6 7 |
|
{ 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
The answer is 10066.
Substituting a b = x and c d = y we have a b c d = 1 0 0 x + y . Writing our equation in terms of x and y , we have x 2 + y 2 = 1 0 0 x + y making a quadratic in x , we have x 2 − 1 0 0 x + ( y 2 − y ) = 0 since x and y are positive integers, the discriminant must be a perfect square. So, 1 0 0 0 0 − 4 y 2 + 4 y must be a perfect square. This implies that this expression must not end in 2 , 3 , 7 , 8 . This implies that y must not end in 1 , 7 , 4 , 9 , 2 . Also, since 1 0 0 0 0 > 4 y 2 − 4 y , y < 5 0 . Now this problem is a lot easier. We will move forward to make it simpler. Let y end in 6 . Then, the term 4 y 2 − 4 y will end in only one zero. But, a perfect square cannot end in an odd number of zeros. So, y should not end in 6 also. Similarly, for 5 the only value where 4 y 2 − 4 y will end in two zeros is y = 2 5 , but that will not give 1 0 0 0 0 − 4 y 2 + 4 y to be a perfect square. So, y must not end in 5 also. Now, y can end in only 3 and 8 . Also, y starting digit can be at max 4 . So, we have only 8 numbers to case-bash. And hence, we will finally get y = 3 3 which gives x = 8 8 ( o r ) 1 2 . So, the sum of the two numbers is 1 2 3 3 + 8 8 3 3 = 1 0 0 6 6
I hope you like the method!!!
Python 2.7:
1 2 3 4 5 6 7 8 |
|
Problem Loading...
Note Loading...
Set Loading...
First, let x = a b and let y = c d . a b c d then becomes 1 0 0 x + y , so the equation of interest is
x 2 + y 2 = 1 0 0 x + y
Now let's complete the square: 4 x 2 + 4 y 2 = 4 0 0 x + 4 y 4 x 2 + 4 y 2 − 4 0 0 x − 4 y = 0 4 x 2 − 4 0 0 x + 1 0 0 0 0 + 4 y 2 − 4 y + 1 = 1 0 0 0 1 ( 2 x − 1 0 0 ) 2 + ( 2 y − 1 ) 2 = 1 0 0 0 1
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 − 1 0 0 = 7 6 yields x = 88, while setting 2 y − 1 = 6 5 yields y = 33. So one of the desired 4-digit numbers is 8 8 3 3 .
To find the other, note that the fact that 7 6 2 + 6 5 2 = 1 0 0 0 1 holds true even if we take 76 and/or 65 to be negative. So let's solve for x and y again. 2 x − 1 0 0 = − 7 6 yields x = 12, while 2 y − 1 = − 6 5 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, 1 2 3 3 .
And of course, 8 8 3 3 + 1 2 3 3 = 1 0 0 6 6