# Number theoretic puzzle involving 123456789

This was an old question in a math competition which I couldn't figure out.

Suppose we have the following situation:

Person A chooses a four-digit natural number. Person B chooses a natural number and adds the square of it to the number chosen by A. Person C chooses a natural number and multiplies the square of it to the number chosen by person A. Then the results of B and C is multiplied and the result is 123456789. What number did A choose?

For clarity: Let the number chosen by A be a, the number chosen by B be b, and the number chosen by C be c. We then have:

$$(b^2 + a)(c^2\cdot a)= 123456789.$$

How would you solve this problem without a calculator?

• The results of B and C are multiplied? – GNUSupporter 8964民主女神 地下教會 Mar 24 '18 at 13:07
• @GNUSupporter: Sorry for the typo in the text. The formula is correct. – Quasar Mar 24 '18 at 13:17
• Well since $a$ is four digits, $c^2$ is at most two so $c$ is one digit. So $c =1$ or $c = 3$ – fleablood Mar 24 '18 at 16:07

The answer is: $a=3607, b=14, c=3$.
Obviously $123456789$ is divisible by $9$: $123456789/9=13717421=:n$.
Let assume that $n$ is square free. In this case $c=3$ and $n=a(a+b^2)$. Let $u$ and $v$ be two complementary divisors of $n$: $u\cdot v =n$. Then: $$(u+v)^2-(u-v)^2=4n \Rightarrow (u+v)^2=4n+(u-v)^2.$$ It follows from our assumption that $u-v=b^2$ is an even perfect square. Adding to $4n$ the squares of even perfect squares one finally is lucky with $u-v=196$, which results in a perfect square. The resulting values $u=3803$ and $v=3607$ are primes, so that the above assumption was correct.
From the prime factor decomposition $123456789=3^2\cdot3607\cdot 3803$ the answer follows.