## Task A-4.2.

How many natural numbers $c \leqslant 1000000$ can be represented in the form

$$
c=a^{2}+3 b^{2}-4 a b
$$

for some integers $a$ and $b$ different from 0?
## Solution.

Notice that the expression $a^{2}+3 b^{2}-4 a b$ is even if and only if $a$ and $b$ have the same parity. If $a$ and $b$ are both even, then $a^{2}$ and $b^{2}$ are divisible by 4, and the expression $a^{2}+3 b^{2}-4 a b$ is divisible by 4.

If $a$ and $b$ are both odd, then $a^{2}$ and $b^{2}$ give a remainder of 1 when divided by 4, and the expression $a^{2}+3 b^{2}-4 a b$ is divisible by 4. This shows that even numbers that are not divisible by 4 cannot be represented in the desired form.

There are 250000 such numbers.

Using the factorization

$$
a^{2}+3 b^{2}-4 a b=(a-3 b)(a-b)
$$

we prove that the numbers 1 and 4 cannot be represented in the desired form.

If $(a-3 b)(a-b)=1$, then $a-3 b=a-b= \pm 1$, i.e., $b=0$, which is not possible.

If $(a-3 b)(a-b)=4$, then $a-3 b=a-b= \pm 2$, i.e., $b=0$ or $a-3 b= \pm 1$ and $a-b= \pm 4$, i.e., $2 b= \pm 3$ or $a-3 b= \pm 4$ and $a-b= \pm 1$, i.e., $2 b=\mp 3$. None of these cases are possible.

All other natural numbers $c \leqslant 1000000$ can be represented in the desired form.

Indeed, if $c=2 k+1, k \geqslant 1$, then for $a=3 k+1, b=k$ we get

$$
a^{2}+3 b^{2}-4 a b=(a-3 b)(a-b)=(3 k+1-3 k)(3 k+1-k)=2 k+1
$$

Indeed, if $c=4 k, k>1$ then for $a=3 k-1, b=k-1$ we get

$$
a^{2}+3 b^{2}-4 a b=(a-3 b)(a-b)=(3 k-1-3 k+3)(3 k-1-k+1)=4 k .
$$

The total number of numbers that can be represented in the desired form is

$$
1000000-250000-2=748998
$$

Note: A student who does not argue why the numbers 1 and 4 cannot be represented in the desired way should receive a maximum of 8 points.