Can 2018 be written as a sum of two squares? If can, what is the expression? 
Can $2018$ be written as a sum of two squares?
If it can be, what are the numbers?

I know the first answer is it can be because $2018=2\times1009$ and $1009\equiv 1 \pmod{4}$. But I cannot find the numbers.
 A: Yes, $2018 = 2\times 1009$ (as prime factorization). Since $1009$ is an odd prime of the form $4k+1$, it can be written as a sum of two squares $1009 = a^2+b^2$. Together with $2 = 1^2 + 1^2$,
Brahmagupta–Fibonacci identity
$$(a^2+b^2)(c^2+d^2) = (ac-bd)^2 + (ad+bc)^2 = (ac+bd)^2 + (ad-bc)^2$$
tell us $2018 = (a+b)^2 + (a-b)^2$.
The task reduces to rewrite $1009$ as a sum of two squares. In addition to
seaching by brute force, one can use algorithms described in
answers of this question to determine $a,b$ efficiently.  At the end, one find $$1009 = 28^2+15^2 \quad\implies\quad 2018 = 43^2 + 13^2$$
A good reference of these sort of algorithms will be Henri Cohen's book
A course in Computation Algebraic Number Theory. Take a look at that if you need more details.
A: You are correct my friend,as per Brahmagupta's Fibonacci identity,it says that-$a^2c^2+a^2d^2+b^2c^2+b^2d^2$=$a^2c^2-2acbd+b^2d^2+a^2d^2+2adbc+b^2c^2$=$a^2c^2+2acbd+b^2d^2+a^2d^2-2adbc+b^2c^2$ just as you are writing 1009=784+225 and 2018=1849+169
