IBM Research | Ponder This | March 2000 solutions
Skip to main content

March 2000

<<February March April>>

There are two different versions of the solution this month.... 1. We have N=10000B+C and N=B^2+C^2.

So 10000B+C=B^2+C^2, 10000B-B^2 = C^2-C.

Also B must lie between 1000 and 9999, in order for N to be an eight-digit number. For each trial value of B in that range, compute f(B)=10000B-B^2.

Let c be the square root of f(B), rounded up to the nearest integer. If our equation is satisfied, we will have f(B)=c^2-c.

(The square root of f(B) will be about C-1/2, so c=C.) So we only have to do about 9000 trials to find the lone answer: B=9412, C=2353, N = 94122353 = 9412^2 + 2353^2. 2. A few readers reminded us how to solve this problem algebraically, without exhaustive search. This write-up follows S V Nagaraj's solution.

Continue to let "^" denote exponentiation.

The solution is obtained by considering 10000B + C = B^2 +C^2,

Rewriting this as 10000^2 +1 = (2*B-10000)^2 +(2*C-1)^2,

we just look at the factorization of 10000^2 + 1 = 10^8 +1 = 17 *5882353.

Express each prime factor as the sum of squares:
17 = 4^2 + 1^2 = w^2 + x^2;
5882353 = 588^2 + 2353^2 = y^2 + z^2.
Then combine them according to the usual laws (related to the multiplication of complex numbers):
(w^2 + x^2)(y^2 + z^2) = (wy+xz)^2 + (wz-xy)^2
(w^2 + x^2)(y^2 + z^2) = (wy-xz)^2 + (wz+xy)^2

The second equation gives an uninteresting solution. The first gives us 4705^2 + 8824^2. Since 2C-1 is odd and 2B-10000 is even, we know which is which. 2C-1=4705 so that C=2353, and 2B-10000=8824 (or -8824) so that B is 9412 (or 588).

B=588 is ruled out by demanding a strict 8-digit number. So the answer is B=9412, C=2353, N=94122353.

If you have any problems you think we might enjoy, please send them in. All replies should be sent to: