Consider the problem of finding the range of the function $f(a, b) = a^2 + a + 2b + 2ab$ for all positive integers $a,\ b$. Factoring this, we find that $f(a, b)\ =\ (a +\ 1)(a +\ 2b)$. However, I can't think of an easy way to find what integer values this function can take on across all $a, b$.
Here is some work I've done so far:
- Observe that $a\ + 1$ and $a +\ 2b$ must have different parity; if $a + 1$ is odd, $a + 2b$ is even, and if $a + 1$ is even, then $a + 2b$ is odd. This implies $f(a,\ b)$ can only take on even integer values.
- Furthermore, if we let $(a\ + 1)(a\ +\ 2b) = k$, my idea was to view $k$ as its prime factorization. Because $a +\ 1$ and $a +\ 2b$ have different parity, one must be divisible by the highest power of $2$ that divides $k$. I feel like this leads to casework on which of the two terms is the even one.
I also wrote a computer program, and found that:
It appears that $(a +\ 1)\(a +\ 2b)$ takes on all even integer values except those that are equal to twice a power of $2$. The smallest few values it takes on are
6, 10, 12, 14, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 66, 68, 70.
Can anyone give me some insights into this specific problem, or to this class of problem in general? Thanks very much!
The only observation missing from the question is that $a+1$ and $a+2b$ are both greater than $1$, one being odd and one being even. This means that in order to be written in this form, $k$ must have an even divisor (and so it cannot be odd) and a nontrivial odd divisor (and so it cannot be a power of $2$).
For any other number, we can factor $k = pq$, where $p$ is odd, $q$ is even, and $p>1$. (For example, we can take $q$ to be the highest power of $2$ dividing $k$, but we don't have to.) Then there are two cases:
If $p < q$, solve $a+1 = p$ and $a+2b = q$ for $a$ and $b$, getting $a = p-1$ and $b = \frac{q-p+1}{2}$. These are both positive integers, because $p>1$ and $q-p \ge 1$.
If $p > q$, solve $a+1 = q$ and $a+2b = p$ for $a$ and $b$ instead, getting $a = q-1$ and $b = \frac{p-q+1}{2}$. These are both positive integers, because $q>1$ and $p-q \ge 1$.
In both cases, we have written $k$ as $(a+1)(a+2b)$ for some positive integers $a$ and $b$.