A 6-Digit Number

Separate a six digit number into two halves, the first three digits and the last three digits. Add the two three digit numbers together and square the sum. The product is the original number. What is the original number? Can you provide a logical explanation with your answer? (Obviously a computer search will work, but is there a logical approach?)

Source: Reader David Armstrong


Solutions were received from Hareendra Yalamanchili, Denis Borris, Joseph DeVincentis, Maree Cassidy, Mrs. Medha Stephen, Radu Ionescu, Gabe Lene, Sudipta Das, John Hewson, Dick Saunders Jr., Michael Boyle, Brian Tivol, Dave Tuller, Mark Michell, Dane Brooke, Jim Boyce, Marcus Macrae, Frances Watkins, Dan Ghinea, Sonia Dawson, Matt Jones, Albert Hattingh, Renzo Benedetti.

There were many great solutions. There are a five answers. Two actual six-digit numbers, and three more if we allow leading zeros on our six digit number:
998001, 494209, 088209, 000001, 000000.
A few of the good logical solutions are below:


From Hareendra Yalamanchili
1000*a+b=(a+b)^2

b^2+(2a-1)b+a^2-1000a=0
b= 1-2a+sqrt(3996a+1) /2

Discriminant must be a perfect square so
3996a+1=k^2, 3996a=(k-1)*(k+1), 3996=4*27*37
k is odd, so the 4 is accounted for.  Only one of k-1 and k+1 can be
divisible by 3, so one of them must be divisible by 27.  One of them
must be divisible by 37.  k has max of sqrt(3996*999+1)=1998 and a min
of sqrt(3996*100+1)=632.

The possibilities are   k-1         k+1
1                    0 mod 37    0 mod 27
2                    0 mod 27    0 mod 37
3                    0 mod 27,37
4                                0 mod 27,37

In case 4, k=-1 mod 999, so k=1997.  This yields the solution 998001
In case 3, k=1 mod 999, so k=1999 which is too high (1000000)
In case 2, k=1*37*19+36*27*11 mod 999 so k=1405 yielding 494209
In case 1, k=1*27*11+26*37*19 mod 999 so k=593 which is too low(88209)

From Dave Tuller
We let the two halves of the 6-digit number be x and y. This means that
we are trying to solve the Diophantine equation (x+y)^2=1000*x+y where
100 <= x, y <= 999. I'll actually solve this for x and y between 0 and
999 which allows the numbers to start with 0. This Diophantine equation
is really just a quadratic in x (y too, but x is easier to handle).
After using the quadratic formula, we get x = 500 - y +/- z where z^2 =
250,000 - 999y. Reducing modulo 999 gives z^2 = 250 (mod 999). Since 999
is not prime, we factor into prime powers: 3^3 * 37. Solving z^2 = 7
(mod 27) and z^2 = 28 (mod 37) and using the Chinese Remainder Theorem
will give us all possible solutions for z. It is easy to find that z =
13 or 14 (mod 27) and 18 or 19 (mod 37). The first can be done by first
solving z^2 = 7 (mod 9) and the latter is from the equivalent z^2 = -9
(mod 37) and noticing that 6^2 = -1 (mod 37) and that since 37 is prime,
there are exactly two solutions for z mod 37. Combining these, we get z
= 203, 499, 500, or 796 (mod 999).

We also have 0 <= z^2 = 250,000 - 999y <= 250,000 so -500 <= z <= 500.
On the other hand, z^2 is all we need (the formula for x has a +/-
before z) so we need only consider z = 203, 499 or 500. By plugging
these numbers in, we get all possible solutions:

000000, 000001, 088209, 494209 and 998001.

If you don't want leading 0s on either the 6-digit or the 3-digit
numbers, the only solution is 494209 = (494+209)^2.

From Brian Tivol

Let the six-digit number N = 1000A + B and let S = A + B.  Because S^2
= N, we have S^2 - S = 999A.  This means (S)(S-1) must be a multiple
of 999.

Since 999 = 3^3 * 37, and since two consecutive numbers can't both be
divisible by 3, we could have:

  I:   27 | S   and 37 | S
  II:  27 | S-1 and 37 | S-1
  III: 27 | S-1 and 37 | S
  IV:  27 | S   and 37 | S-1

(The expression "a|b" means that there is an integer k
such that ak = b.)

Case I gives S = 0 (mod 999).  Case II gives S = 1 (mod 999).

To solve Case III, we need to find an integer k such that 37k = 1 (mod
27).  A little bit of hunting gives us only k = 19 (mod 27), so S =
703 (mod 999).

If 37 | S and 27 | S-1, then 27 | (-S+1) and 37 | (-S+1)-1.
Therefore, the solution to Case IV is S = -703+1 = 297 (mod 999).  (We
named Case III and IV in that order because Case III is easier to
solve.)

Now we have a quick table to work through.  We know that S < 1000.  If
leading zeroes are disallowed, then S > 316 as well.  For each
possible S in that range, we find S(S-1)/999 = A and S-A = B.

      S     A     B
   ====  ====  ====
      0     0     0
      1     0     1
    297    88   209
    703   494   209
    999   998     1

Don't forget that sneaky final entry in the table!  If no leading
zeroes are allowed whatsoever, the only answer is N = 494209.  If
leading zeroes are allowed for B, we also get N = 998001.  If all
sorts of leading zeroes are allowed, we can also include N = 088209, N
= 000001, and N = 000000.

Mail to Ken