Squaring by conjugation

Suppose a b c \overline{abc} and d e f \overline{def} are three-digit numbers such that ( a b c + d e f ) 2 = a b c d e f . (\overline{abc}+\overline{def})^2=\overline{abcdef}.

Find a b c . \overline{abc}.

Details and assumptions

a b c \overline{abc} means 100 a + 10 b + 1 c 100a + 10b + 1c , as opposed to a × b × c a \times b \times c . As an explicit example, for a = 2 , b = 3 , c = 4 a=2, b=3, c=4 , a b c = 234 \overline{abc} = 234 and not 2 × 3 × 4 = 24 2 \times 3 \times 4 = 24 .

The number 12 = 012 12=012 is a 2-digit number, not a 3-digit number.


The answer is 494.

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.

13 solutions

Thomas Beuman
Aug 20, 2013

Let x = a b c x = \overline{abc} and y = d e f y = \overline{def} . The problem can then be restated as finding the solution(s) of

( x + y ) 2 = 1000 x + y 100 x , y < 1000 (x+y)^2 = 1000x+y \qquad 100 \leq x,y < 1000

Rewriting and solving for x x :

0 = x 2 + 2 ( y 500 ) x + y 2 y x = 500 y ± ( y 500 ) 2 ( y 2 y ) = 500 y ± 50 0 2 999 y 0 = x^2 + 2(y-500)x + y^2-y \\ x = 500-y \pm \sqrt{(y-500)^2 - (y^2-y)} \\ \ \ = 500-y \pm \sqrt{500^2 - 999y}

A necessary condition is thus that 50 0 2 999 y 500^2 - 999y is the square of some integer, to be called k k . We can write

999 y = 50 0 2 k 2 = ( 500 k ) ( 500 + k ) 999y = 500^2 - k^2 = (500-k)(500+k)

We are thus looking for a factorization 999 y = p q 999y = pq , where p p and q q are positive integers with p + q = 1000 p+q=1000 .

Note that 999 = 3 3 37 999 = 3^3 \cdot 37 . Clearly p p and q q cannot both be divisible by 3 3 , since then p + q p+q would also be divisible by 3 3 and hence not 1000 1000 . Therefore, one of the factors (let us say p p ) must be divisible by 27 27 , i.e. p = 27 s p = 27s for some integer s s .

Furthermore, either p p or q q (or both) must be divisible by 37 37 . However, it cannot be p p , since then it's divisible by 999 999 and this gives the solution p = 999 p=999 , q = 1 q=1 and thus y = 1 y=1 , which violates y 100 y \geq 100 . Therefore, q q must be divisible by 37 37 and we can write q = 37 t q = 37t for some integer t t .

We now have the equation

1000 = p + q = 27 s + 37 t 1000 = p+q = 27s + 37t

Modulo 9 9 , this reads t 1 t \equiv 1 , which reduces the possible values of t t to the set { 1 , 10 , 19 } \{1,10,19\} . Trial and error reveals that the only solution is s = 11 s=11 and t = 19 t=19 . This gives p = 297 p = 297 , q = 703 q = 703 , y = s t = 209 y = st = 209 and k = 500 p = 500 q = 203 k=|500-p|=|500-q|=203 .

For x x we find

x = 500 y ± 50 0 2 999 y = 500 y ± k = 291 ± 203 x = 500-y \pm \sqrt{500^2 - 999y} = 500-y \pm k = 291 \pm 203

The solution x = 291 203 = 88 x = 291-203 = 88 violates x 100 x \geq 100 , hence x = 291 + 203 = 494 x = 291 + 203 = \boxed{494}

( 494 + 209 ) 2 = 494209 (494+209)^2 = 494209

Moderator note:

Great job! Very clear and complete solution.

Well , isn't Sharvik's solution easier ?

Priyansh Sangule - 7 years, 9 months ago

Let M = a b c M = \overline{abc} & N = d e f N = \overline{def} . So, ( M + N ) 2 = 1000 M + N (M + N)^2 = 1000M + N

Expansion gives M 2 + M ( 2 N 1000 ) + ( N 2 N ) = 0 M^2 + M(2N - 1000) + (N^2 - N) = 0 which is a quadratic in M M .

It's discriminant Δ = ( 2 N 1000 ) 2 4 ( N 2 N ) = 1 0 6 3996 N = 4 ( 250000 999 N ) \Delta = (2N - 1000)^2 - 4(N^2 - N) = 10^6 - 3996N = 4 (250000 - 999N)

Clearly, 250000 999 N < 250000 = 500 \sqrt{250000 - 999N} < \sqrt{250000} = 500

So we may put: 250000 999 N = ( 500 i ) 2 250000 - 999N = (500 - i)^2 for some positive integer i i . Finally, i ( 1000 i ) = 999 N i(1000 - i) = 999N

The equation is quite symmetric in i i (due to presence of ( 1000 i ) (1000 - i) ),so we may assume: 27 i i = 27 r 27 | i \Rightarrow i = 27r for some r. Plugging in, we get: r ( 1000 27 r ) = 37 N r(1000 - 27r) = 37N Now 37 doesn't divide i i , for then it would have become 999 itself,not possible. So 1000 27 r = 37 p 1000 - 27r = 37p for some p.

Hence, r = 1000 37 p 27 = 37 p 10 p 1 27 r = \frac{1000 - 37p}{27} = 37 - p - \frac{10p - 1}{27} which is integral for p = 19 p = 19 . Thus, r = 11 , i = 297 r = 11, i = 297 , N = 209 N = 209 & finally M = 494 M = 494 .

Moderator note:

Nice solution! Please look at the author's comment for some fine details.

Oh,there's a slight discrepancy... I could assume 27 i 27 | i since 999 = 3 3 37 999 = 3^3*37 & i i & ( 1000 i ) (1000 - i) cannot be both divisible by 3 or by 37. This is easily verifiable by considering these ( m o d 3 ) \pmod{3} & ( m o d 37 ) \pmod{37} respectively.

A Brilliant Member - 7 years, 9 months ago

Log in to reply

Nice solution!!!

Cody Johnson - 7 years, 9 months ago
Sharvik Mital
Aug 23, 2013

let abc be x x and def be y y (here abc and def are the numbers)

Then ( x + y ) 2 (x+y)^{2} = 1000 × x 1000 \times x + + y y

( x + y ) 2 (x+y)^{2} = 999 x + x + y 999x + x + y

( x + y ) × ( x + y 1 ) (x+y) \times (x+y-1) = 999 × x 999 \times x

( x + y ) × ( x + y 1 ) (x+y) \times (x+y-1) = 27 × 37 × x 27 \times 37 \times x

So product of two consecutive positive integers = 27 × 37 × x 27 \times 37 \times x .

Now out of two consecutive integers only one is divisible by 3 ,therefore

Numbers ( x + y ) (x+y) and ( x + y 1 ) (x+y-1) will be of the form 27 k k and 37 m m where m × k m \times k = x x (here m and k should be positive)

Now numbers 27 k k and 37 m m should be consecutive

If 27 k k -37 m m =1

Then k k = (1+10 m m )/27 + m m

m m =8 and k k = 11 will be one solution but the product of k and m is 88 but x x is 3 digit number

and the next solution is m m =35 and k k = 48 whose product is 4 digit.

If 37 m m -27 k k =1

Then m m = (1-10 k k )/37 + k k

k k =19 , m m =26 and so x=494

so abc =494

Same thing which I did, although after the problem set expired.

Siddharth Kumar - 7 years, 9 months ago

Nice solution ,

Typo in the line - ...is 88 and x ... shouldn't it be ' but ' ?

Thank you

Priyansh Sangule - 7 years, 9 months ago
Matt Mistele
Aug 19, 2013

Let M = a b c M= \overline{abc} and N = d e f N= \overline{def} . Then the given equation becomes ( M + N ) 2 = 1000 M + N (M+N)^2 = 1000M + N .

If we expand the left-hand side, subtract 1000 M + N 1000M + N from both sides, and solve for M using the quadratic equation, we get M = 1000 2 N ± ( 1000 2 N ) 2 4 ( N 2 N ) 2 M= \frac{1000-2N \pm \sqrt{(1000-2N)^2-4(N^2-N)}}{2} ,

which works out to M = 500 N ± 50 0 2 999 N M = 500-N \pm \sqrt{500^2-999N} .

Since M needs to be an integer, 50 0 2 999 N 500^2-999N must be a perfect square, so we let 50 0 2 999 N = K 2 500^2-999N=K^2 for some integer K.

Switching 999 N 999N with K 2 K^2 and factoring the resulting difference of squares, we get 999 N = ( 500 + K ) ( 500 K ) 999N = (500+K)(500-K) . That tells us 999 ( 500 + K ) ( 500 K ) 999 | (500+K)(500-K) .

Now we factor 999 into 3 3 37 3^3*37 and try to come up with more useful divisibility statements. First, notice that only one of (500+K) and (500-K) can be divisible by 3. That means it must also be divisible by 3 3 3^3 . That, in turn, means the other expression must be divisible by 37. (Otherwise, we'd have 999|(500+K), which leads to the 1-digit solution N=1.)

Let's investigate the case where 500 K 0 ( m o d 27 ) 500-K \equiv 0\pmod{27} and 500 + K 0 ( m o d 37 ) 500+K \equiv 0\pmod{37} .

Solving for K in each, we get the set of congruences

K 14 ( m o d 27 ) K \equiv 14 \pmod{27}

K 18 ( m o d 37 ) K \equiv 18 \pmod{37}

Using the second mod relation, we can let K = 18 + 37 L K = 18 + 37L for some nonnegative integer L. Plugging into the first relation, we get

18 + 37 L 14 ( m o d 27 ) 18+37L \equiv 14 \pmod{27}

10 L 23 ( m o d 27 ) 10L \equiv 23 \pmod{27}

Noticing that 23 50 10 5 ( m o d 27 ) 23 \equiv 50 \equiv 10*5 \pmod{27} we find L 5 ( m o d 27 ) L \equiv 5 \pmod{27} . 5 is the only value of L that prevents 500 K 500-K from going negative, so L = 5 L=5 .

We can now find the values of our other variables:

K = 18 + 37 5 = 203 K = 18 + 37*5 = 203

999 N = 703 297 999N = 703*297 , so N = 209 N=209

M = 500 209 ± 203 M = 500-209 \pm 203 . We use M = 494 M=494 since M must have 3 digits.

We verify that ( 494 + 209 ) 2 = 494209 (494+209)^2=494209 , and our work is complete! M = 494 M =\fbox{494} .

(Note: the other case, where 500 + K 0 ( m o d 27 ) 500+K \equiv 0\pmod{27} and 500 K 0 ( m o d 37 ) 500-K \equiv 0\pmod{37} , produces no valid solutions).

Let x = a b c x=\overline{abc} and y = d e f y=\overline{def} . Then we have x 2 + 2 x y + y 2 = 1000 x + y x^2+2xy+y^2=1000x+y y 2 + ( 2 x 1 ) y + x 2 1000 x = 0 y^2+(2x-1)y+x^2-1000x=0 . We know that y y must be integer, so D = ( 2 x 1 ) 2 4 ( x 2 1000 x ) = 3996 x + 1 D=(2x-1)^2-4(x^2-1000x)=3996x+1 must be square of an integer. Let 3996 x + 1 = m 2 3996x+1=m^2 . Then 3996 x = ( m 1 ) ( m + 1 ) 3996x=(m-1)(m+1) We know that m 1 m-1 and m + 1 m+1 have same parity, Then since 3996 x 3996x is even, both m 1 m-1 and m + 1 m+1 are even. 3996 = 4 27 37 3996=4*27*37 . From here, we take some cases. \\

Case 1. m 1 = 2 a c m-1=2ac , and m + 1 = 2 b d m+1=2bd , with a b = 999 ab=999 , and c d = x cd=x . If 3 m 1 3\mid m-1 , then 3 m + 1 3\nmid m+1 . Also if 3 m + 1 3\mid m+1 , then 3 m 1 3\nmid m-1 So between a a or b b is divisible by 3.

Case 1a. If 3 a 3|a , then 3 b 3\nmid b . So the only possibility for a a is a = 27 a=27 , thus b = 37 b=37 , since 27 37 = 999 27*37=999 . This will give 27 c 1 = 37 d 27c-1=37d . Means that c = 37 d + 1 27 = d + 10 d + 1 27 c=\dfrac{37d+1}{27}=d+\dfrac{10d+1}{27} is an integer. We know that for d = 8 d=8 , c c is an integer, and also for d = 27 e + 8 d=27e+8 , for an integer e e . For d = 8 d=8 we have c = 11 c=11 , so x = 88 x=88 . It's impossible. For e > 0 e>0 , then we will have x > 1000 x>1000 which is also impossibru.

Case 1b. If 3 a 3\nmid a and 3 b 3|b , then the only possibility for b b is b = 27 b=27 , and a = 37 a=37 . This will give 37 c 1 = 27 d 37c-1=27d . And with the same argument from case 1a., we will not have x x that we want.

Case 2. If m 1 = 4 a c m-1=4ac , and m + 1 = b d m+1=bd . Same argument, the value between a a or b b is 27 27

Case 2a. If b = 27 b=27 , then a = 37 a=37 . This will gives 148 c + 2 = 27 d 148c+2=27d . Then d = 148 c + 2 27 = 5 c + 13 c + 2 27 d=\dfrac{148c+2}{27}=5c+\dfrac{13c+2}{27} is an integer. We know that for c = 4 c=4 , d d is an integer. So we can write c = 27 e + 4 c=27e+4 , for integer e e . For c = 4 c=4 , then d = 22 d=22 , which gives x = 88 x=88 . It's impossible. For e > 0 e>0 , we will have x > 1000 x>1000 , which is also impossible.

Case 2b. For a = 27 a=27 and b = 37 b=37 . This will give 108 c + 2 = 37 d 108c+2=37d . So d = 108 c + 2 37 = 3 c + 2 3 c 37 d=\dfrac{108c+2}{37}=3c+\dfrac{2-3c}{37} is an integer. For c = 13 c=13 , then d d is an integer. So we can write c = 37 e + 13 c=37e+13 , for integer e e . If c = 13 c=13 , then d = 38 d=38 , which gives x = 494 x=494 . If e > 0 e>0 , then we will get x > 1000 x>1000 , which is impossible.

After all of case, we finally get x = 494 x=494 . For x = 494 x=494 , then D = 1405 D=1405 . So y = 2 494 + 1 + 1405 2 = 209 y=\dfrac{-2*494+1+1405}{2}=209 So a b c = x = 494 \overline{abc}=x=494

Nhat Le
Aug 20, 2013

Let x = a b c x= \overline{abc} and y = d e f y=\overline{def} . Then we have ( x + y ) 2 = 1000 x + y (x+y)^2 = 1000x+y .

To simplify things further, let k = x + y k=x+y . This would give us y = k x y=k-x . Note that k k should be in the range 0 < k < 1000 0<k<1000 , since 0 < a b c d e f = k 2 < 1000000 0<\overline{abcdef}=k^2<1000000 .

Substituting k = x + y k=x+y and y = k x y=k-x into the original equation, we arrive at k 2 = 1000 x + k x k^2 = 1000x+k-x or k 2 k = 999 x k^2-k =999x .

And so we see that k ( k 1 ) k(k-1) is divisible by 999 = 27 × 37 999=27 \times 37 .

Since k k and k 1 k-1 are relatively prime, there are four cases:

Case 1: k k is divisible by 999 999 . The only possible value of k k is 999 999 since 0 < k < 1000 0<k<1000 . Thus in this case a b c x y z = k 2 = 998001 \overline{abcxyz}= k^2=998001 , but 001 001 is not a three-digit number, so this is invalid.

\mbox{}

Case 2: k 1 k-1 is divisible by 999 999 . The only k k in the range 0 < k < 1000 0<k<1000 that satisfies this is k = 1 k=1 , but this is certainly not valid.

\mbox{}

Case 3: k 1 k-1 is divisible by 37 37 and k k is divisible by 27 27 .

Thus k 1 ( m o d 37 ) k \equiv 1 \pmod{37} and k 0 ( m o d 27 ) k \equiv 0 \pmod{27} .

By the Chinese Remainder theorem, k 297 ( m o d 27 × 37 ) k \equiv 297 \pmod{27\times 37} , or k 297 ( m o d 999 ) k \equiv 297 \pmod{999} . The only value of k k in the range 0 < k < 1000 0<k<1000 is 297 297 . Thus a b c d e f = 29 7 2 = 88209 \overline{abcdef} = 297^2 = 88209 , but 088 088 is not a three-digit number, so this is also invalid.

\mbox{}

Case 4: k 1 k-1 is divisible by 27 27 and k k is divisible by 37 37 .

Thus k 1 ( m o d 27 ) k \equiv 1 \pmod{27} and k 0 ( m o d 37 ) k \equiv 0 \pmod{37} .

By the Chinese Remainder theorem, k 703 ( m o d 27 × 37 ) k \equiv 703 \pmod{27\times 37} , or k 703 ( m o d 999 ) k \equiv 703 \pmod{999} . The only value of k k in the range 0 < k < 1000 0<k<1000 is 703 703 . Thus a b c d e f = 70 3 2 = 494209 \overline{abcdef} = 703^2 = 494209 . This satisfies the conditions of the question.

Hence, a b c = 494 \overline{abc} = \fbox{494}

Pi Han Goh
Aug 19, 2013

[This method requires some tedious calculation but it reduces the number of trials to a mere 37]

Since a b c d e f \overline{abcdef} is a 5 digit perfect square, then 1 0 5 a b c d e f < 1 0 6 10^5 \leq \overline{abcdef} < 10^6 . Or 316 < a b c d e f 999 316 < \sqrt{\overline{abcdef} } \leq 999

Let A = a b c A = \overline{abc} , B = d e f B = \overline{def}

Then essentially, we want to solve ( A + B ) 2 = 1000 A + B (A + B)^2 = 1000A + B with constraints 100 A , B 999 100 \leq A, B \leq 999 , 316 A + B 999 316 \leq A+ B \leq 999

Take mod of 37 to both sides (knowing that 1000 m o d 37 = 1 1000 \bmod{37} = 1 ), we have ( A + B ) 2 ( A + B ) (A + B)^2 \equiv (A + B) . Or A + B 0 , 1 ( m o d 37 ) A + B \equiv 0, \space 1 \pmod{37}

For A + B 0 ( m o d 37 ) A + B \equiv 0 \pmod{37} , the possible values of A + B A +B are 333 , 370 , 409 , , 962 , 999 333,370,409, \ldots, 962, 999

Similarly, for A + B 1 ( m o d 37 ) A + B \equiv 1 \pmod{37} , the possible values of A + B A +B are 334 , 371 , 410 , , 963 334,371,410, \ldots, 963

With these values, we apply trial and error to ( A + B ) 2 = 1000 A + B (A + B)^2 = 1000A + B gives A + B = 703 A + B = 703 as the only possible solution

70 3 2 = 494209 = ( 494 + 209 ) 2 a b c = A = 494 \Rightarrow 703^2 = 494209 = (494 + 209)^2 \Rightarrow \overline{abc} = A = \boxed{494}

I have a question, isnt abcdef a 6 digit perfect square? How come you said it is a 5 digit perfect perfect square?

Revanth Gumpu - 7 years, 9 months ago

Log in to reply

Yeah you're right. I can't even count to 6. HAHA!

Pi Han Goh - 7 years, 9 months ago

Log in to reply

It's alright.

Revanth Gumpu - 7 years, 9 months ago

When you say "With these values, we apply trial and error to (A+B)2=1000A+B gives A+B=703 as the only possible solution", How do you get that by trial and error?

Revanth Gumpu - 7 years, 9 months ago

Log in to reply

Take for example, if A + B = 370 A + B = 370 , then ( A + B ) 2 = 136900 = 1000 A + B (A+B)^2 = 136900 = 1000A + B , this gives A = 136 , B = 900 A = 136, B=900 but it didn't satisfy A + B = 370 A+B=370

Pi Han Goh - 7 years, 9 months ago
Laurent Shorts
Feb 12, 2017

999 = 3 3 37 999=3^3·37

  • Modulo 3 3 = 27 3^3=27 : ( x + y ) 2 x + y (x+y)^2\equiv x+y , so x + y 0 x+y\equiv 0 or x + y 1 x+y\equiv 1 .
  • Modulo 37 37 : ( x + y ) 2 x + y (x+y)^2\equiv x+y , so x + y 0 x+y\equiv 0 or x + y 1 x+y\equiv 1 .

So there's four possibilities. With Euclid's algorithm, we find 27 11 37 8 = 1 27·11-37·8=1 , and so, modulo 999, x + y x+y must be:

x + y 0 x+y\equiv 0 mod 37 x + y 1 x+y\equiv 1 mod 37
x + y 0 x+y\equiv 0 mod 27 \ \ \ \ \ 0 27 11 = 297 27·11=297
x + y 1 x+y\equiv 1 mod 27 8 37 = 296 703 -8·37=-296\equiv 703 \ \ \ \ \ 1

As ( x + y ) 2 (x+y)^2 is a 6-digits number, x + y < 1000 x+y<1000 , so we only have to check x + y x+y in 1, 297, 703 and 999.

  • 1 2 = 1 1^2=1 , not a 6-digits number
  • 29 7 2 = 8 8 209 297^2=88'209 , not a 6-digits number
  • 70 3 2 = 49 4 209 703^2=494'209 , so x = 494 x=494 and y = 209 y=209
  • 99 9 2 = 99 8 001 999^2=998'001 , so x = 998 x=998 and y = 1 y=1 , but y y has to be a 3-digits number.

Only possibility left: x = 494 , y = 209 \boxed{x=494,\ y=209}

1
2
3
4
5
6
7
8
9
out_switch = True
for spam in xrange(100,1000):
    for eggs in xrange(100,1000):
        if (spam + eggs)**2 == int( str(spam)+str(eggs) ):
            print spam
            out_switch = False
            break
    if out_switch == False:
        break

What does this have to do with the problem?

Calvin Lin Staff - 5 years, 11 months ago
Sayan Chakrabarty
Aug 23, 2013

I used the following C program to find such numbers;

include<stdio.h>

include<conio.h>

void main() { unsigned long i,x,y,rem[6]; clrscr(); for(x=317;x<=999;x++) { y=x x; for(i=0;i<6;i++) { rem[i]=y%10; y=y/10; } if((rem[0]+10 rem[1]+100 rem[2])+(rem[3]+10 rem[4]+100*rem[5])==x) printf("\n%lu",x); } getch(); } The output is 703 and 999. Now 999^2=998001 in which 001 is not of 3 digits. And 703^2=(494+209)^2=494209 Hence 703 is the result.

Hahaha nice!

Luke Nelson - 7 years, 9 months ago
Russell Few
Aug 21, 2013

We let a b c = x \overline{abc}=x and d e f = y \overline{def}=y .

The equation becomes ( x + y ) 2 = 1000 x + y (x+y)^2=1000x+y . We expand it to get x 2 + 2 x y + y 2 = 1000 x + y x^2+2xy+y^2=1000x+y . Treating it into a quadratic in x x makes it x 2 + ( 2 y 1000 ) x + ( y 2 y ) = 0 x^2+(2y-1000)x+(y^2-y)=0 . x = ( 2 y 1000 ) ± ( 2 y 1000 ) 2 4 ( 1 ) ( y 2 y ) ( 2 ) ( 1 ) = ( 2 y 1000 ) ± 4 y 2 4000 y + 1000000 4 y 2 + 4 y 2 x=\frac{-(2y-1000) \pm \sqrt{(2y-1000)^2-4(1)(y^2-y)}}{(2)(1)} =\frac{-(2y-1000) \pm \sqrt{4y^2-4000y+1000000-4y^2+4y}}{2} , which is equal to 500 y ± 250000 999 y 500-y \pm \sqrt{250000-999y}

Hence 250000 999 y 250000-999y must be a perfect square. We let 250000 999 y = k 2 250000-999y=k^2 . So 500 + k ) ( 500 k ) = 999 y 500+k)(500-k)=999y . We let 500 + k = p 500+k=p and 500 k = q 500-k=q , where k could be negative. p + q = 1000 p+q=1000 and their product is a multiple of 999 999 . Hence it must be a multiple of both 27 27 and 37 37 .

Since 1000 1000 is not a multiple of 3 3 , not both p p and q q could be multiples of 3 3 . Thus the multiple of 37 is not a multiple of 3, and the number that is not the multiple of 37 is a multiple of 27.

WLOG let p p be the multiple of 37. Then we let p = 37 m p=37m and q = 27 n q=27n . 37 m + 27 n = 1000 37m+27n=1000 . Reducing m o d 37 mod 37 , we know that 27 n 27n is congruent to 1 m o d 37 1 mod 37 .

By Guess and Check, we know that n = 297 n=297 , as n n is at most 999 999 .

Hence k = 203 k=203 , and y = ( 703 ) ( 297 ) 999 = 209 y=\frac{(703)(297)}{999}=209 , and x = 291 ± 250000 999 ( 209 ) = 291 ± 203 x=291 \pm \sqrt{250000-999(209)}=291 \pm 203 . Since x x is a 3 digit number, x = 291 + 203 = 494 x=291+203=494 .

Since x = a b c x=\overline{abc} , a b c = 494 \overline{abc}=\boxed{494}

Cole Coupland
Aug 20, 2013

Since there hasn't been programming questions for a while I decided to solve this one with Python using the code below. I defined a b c \overline{abc} as x x and d e f \overline{def} as y y . Since we know that they are three digit numbers we can make the range between 100 100 and 999 999 . In the third line of the code I defined a b c d e f \overline{abcdef} as ( 1000 x ) + y (1000x) + y as they are equivalent statements. If the equality holds the the next line of code is run which prints the value of x x . This is the solution to the problem as x = a b c x = \overline{abc} .

    for x in range(100, 1000):

        for y in range(100, 1000):

            if (x+y)**2 == (1000*x)+y:

                        print(x)

When the code is executed the output for x x is 494 494 .

Mharfe Micaroz
Aug 19, 2013

step 1: go to this site Online Python Interpreter

step 2: copy paste this code, then run

for a in range(1,10):

>for b in range(0,10):

>>for c in range(0,10):

>>>for d in range(0,10):

>>>>for e in range(0,10):

>>>>>for f in range(0,10):

>>>>>>_abc=100*a+10*b+c

>>>>>>_def=100*d+10*e+f

>>>>>>_abcdef=100000*a+10000*b+1000*c+100*d+10*e+f

>>>>>>if ( abc+ def)**2 == _abcdef:

>>>>>>>print _abc

>>>>>>>break

Output: 494

I wouldn't encourage using Python to solve non-CS problems on Brilliant. Either way, it is not a very good program. You could just have used two loops: one for A A and one for B B with 100 A , B < 1000 100 \leq A,B < 1000 , and just check whether

( A + B ) 2 = 1000 A + B . (A+B)^2 = 1000A + B .

Another thing, you do use break , but notice that it only breaks out of the last loop, not the other 5. So it isn't very effective.

Tim Vermeulen - 7 years, 9 months ago

Log in to reply

so youre thinking your just the good one.. Ok YOUR GOOD, I accepted it.. Are you happy now? =p

Mharfe Micaroz - 7 years, 9 months ago

cheeeeeeeeeeeeeeeeeeeetah

Cody Johnson - 7 years, 9 months ago

Log in to reply

its not cheating... its resourcefulness...hahahaah

Mharfe Micaroz - 7 years, 9 months ago

Log in to reply

It is not real resourcefulness. The real resourcefulness is being able to solve the problem without the computer's help. A comparison: a resourceful person can fix a bike with whatever is at hand. And anybody can fix a bike with money and a repair shop. Computer skills are valuable, but using them to solve this kind of problems is just cheating yourself of a good challenge.

Alexander Borisov - 7 years, 9 months ago

One thing is that you use Python on your own to solve it, that is your problem. Other thing is that you are continue encouraging other people to use Python to solve the problems which misses completly the point and is what I have seen in many solutions you give. When we (people who haven't got the problem, like me) look the solutions of the problem, we want to see how it is solved using mathematica. So at least do not post your solution using these methods.

Jordi Bosch - 7 years, 9 months ago

Using electronic help for solving Brilliant mathematics problems isn't legal, I guess!

Sreejato Bhattacharya - 7 years, 9 months ago

Log in to reply

yeah ur ryt Sreejato.... those two guys above are just being so arrogant, thinking theyre just the one who can solve brilliant problems in the diffferent manner..

Mharfe Micaroz - 7 years, 9 months ago

yeah ur ryt..! those two guys above are just being too arrogant.. thinking that they are the only one who can solve brilliant problems in the different way..=p

Mharfe Micaroz - 7 years, 9 months ago

Log in to reply

I disagree. There are a lot of challenging computer science problems on the net, ProjectEuler for example. These problems are meant to be solved by hand. Also, as Tim pointed out, even if you wanted to use a computer to solve this problem, this algorithm is the most inefficient way to do so.

Sreejato Bhattacharya - 7 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...