# 2016 AIME I Problems/Problem 7

## Problem

For integers $a$ and $b$ consider the complex number $$\frac{\sqrt{ab+2016}}{ab+100}-\left({\frac{\sqrt{|a+b|}}{ab+100}}\right)i$$

Find the number of ordered pairs of integers $(a,b)$ such that this complex number is a real number.

## Solution

We consider two cases:

Case 1: $ab \ge -2016$.

In this case, if $$0 = \text{Im}\left({\frac{\sqrt{ab+2016}}{ab+100}-\left({\frac{\sqrt{|a+b|}}{ab+100}}\right)i}\right) = -\frac{\sqrt{|a+b|}}{ab+100}$$ then $ab \ne -100$ and $|a + b| = 0 = a + b$. Thus $ab = -a^2$ so $a^2 < 2016$. Thus $a = -44,-43, ... , -1, 0, 1, ..., 43, 44$, yielding $89$ values. However since $ab = -a^2 \ne -100$, we have $a \ne \pm 10$. Thus there are $87$ allowed tuples $(a,b)$ in this case.

Case 2: $ab < -2016$.

In this case, we want $$0 = \text{Im}\left({\frac{\sqrt{ab+2016}}{ab+100}-\left({\frac{\sqrt{|a+b|}}{ab+100}}\right)i}\right) = \frac{\sqrt{-ab-2016} - \sqrt{|a+b|}}{ab+100}$$ Squaring, we have the equations $ab \ne -100$ (which always holds in this case) and $$-(ab + 2016)= |a + b|.$$ Then if $a > 0$ and $b < 0$, let $c = -b$. If $c > a$, $$ac - 2016 = c - a \Rightarrow (a - 1)(c + 1) = 2015 \Rightarrow (a,b) = (2, -2014), (6, -402), (14, -154), (32, -64).$$ Note that $ab < -2016$ for every one of these solutions. If $c < a$, then $$ac - 2016 = a - c \Rightarrow (a + 1)(c - 1) = 2015 \Rightarrow (a,b) = (2014, -2), (402, -6), (154, -14), (64, -32).$$ Again, $ab < -2016$ for every one of the above solutions. This yields $8$ solutions. Similarly, if $a < 0$ and $b > 0$, there are $8$ solutions. Thus, there are a total of $16$ solutions in this case.

Thus, the answer is $87 + 16 = \boxed{103}$.

(Solution by gundraja)

## Solution 2

Similar to Solution 1, but concise:

First, we set the imaginary expression to $0$, so that $|a+b|=0$ or $a=-b$, of which there are $44\cdot 2+1=89$ possibilities. But $(a,b)\ne(\pm 10,\mp 10)$ because the denominator would be $0$. So this gives $89-2=87$ solutions.

Then we try to cancel the imaginary part with the square root of the real part, which must be negative. So $ab<-2016$. $ab+2016=-|a+b|\rightarrow ab\pm a\pm b+2016=0\rightarrow (a\pm 1)(b\pm 1)=-2015$ by Simon's Favorite Factoring Trick.

We must have the negative part lesser in magnitude than the positive part, because an increase in magnitude of a lesser number is MORE than a decrease in the magnitude of a positive number, so the product will net to be more magnitude, namely $ab<-2016$ and $-2015\approx -2016$.

The factors of $(\text{-})2015$ are $(\text{-})5\cdot 13\cdot 31$, so the $(a+1,b+1)=\{(-1,2015),(-5,403), (-13,155),(-31,65)\}$ and the sets flipped.

Similarly from the second case of $(a-1,b-1)$ we also have $8$ solutions.

Thus, $(a,b),(b,a)=\{(\mp 2,\pm 2014),(\mp 6,\pm 402),(\mp 14,\pm 154),(\mp 32,\pm 64)\}$. Surely, all of their products, $ab=-4028,-2412,-2156,-2048<-2016$.

So there are $87+16=\boxed{103}$ solutions.

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. 