6. For natural numbers $a$ and $b$ we are given that $2019=a^{2}-b^{2}$. It is known that $a<1000$. What is the value of $a$ ?
Solution
338

We can write $2019=(a+b)(a-b)$. The integers $a+b$ and $a-b$ must be a factor pair of 2019 . There are two such factor pairs: 2019,1 and 673,3 . These yield $(a, b)=(1010,1009)$ and $(a, b)=(338,335)$ respectively. As the answer must be at most 999 , we conclude that $a=338$.