<s>[INST] When is $\frac{x^2+xy+y^2}{49}$ an integer? 
Find the number of distinct ordered pairs $(x, y)$ of positive integers such that $ 1\leq x, y \leq 49$ and $\frac{x^2+xy+y^2}{49}$ is an integer.

Multiplying the given equation by $(x-y)$ gives $x^3 \equiv y^3 \pmod{49}$. Thus we can't have $7 \mid x$ while $7 \nmid y$ or vice-versa. Rearranging the given equation gives $$(x+y)^2 \equiv xy \pmod{49}.$$ 
If $7 \mid x,y$ then there are $49$ solutions. Now suppose that $7 \nmid x,y$. Then we have $$(x+y)^2(xy)^{-1} \equiv xy^{-1}+2+xy^{-1} \equiv 1 \pmod{49}.$$ Thus, $xy^{-1}+yx^{-1} \equiv xy^{-1}(1+(yx^{-1})^2) \equiv -1 \pmod{49}$.
I didn't see how to continue from here. The answer is $$2\varphi(49)+49,$$ and $\varphi(49)$ is the number of units modulo $49$, so maybe we can use that to solve this question.
 [/INST] The square roots of $-3 \pmod 7$ are $2,5.$ We ask when
$$ (2 + 7t)^2 \equiv -3 \pmod {49}, $$
with only solution $t =5$ and the square root being $37 \pmod{49}.$
We ask when
$$ (5 + 7t)^2 \equiv -3 \pmod {49}, $$
with only solution $t =1$ and the square root being $12 \pmod {49}.$
This little procedure is the beginning of Hensel's Lemma. Indeed, given two solutions $r_i$ to $$ r_i^2 \equiv -3 \pmod {7^k},   $$
 we arrive at exactly two solutions  to
$$ s_i^2 \equiv -3 \pmod {7^{k+1}} $$ such that
$$s_i \equiv r_i \pmod{7^k}.  $$
Take $x \equiv 1 \pmod {49}$ and solve
$$ x^2 + xy + y^2 \equiv 0 \pmod {49}. $$
Two and four are invertible $\pmod {49},$ so we have
$$ 4 x^2 + 4xy + 4 y^2 \equiv 0 \pmod {49}  $$
W took $x=1,$ so we now have
$$ 4 + 4y + 4 y^2 \equiv 0 \pmod{49}.  $$
$$ 3 + (2y+1)^2 \equiv 0 \pmod {49}.  $$
$$ (2y+1)^2 \equiv -3 \pmod {49}.  $$
$$ 2y+1 \equiv 12, 37 \pmod {49}.  $$
$$ 2y \equiv 11,36 \pmod{49}.  $$
$$ 2y \equiv 60,36 \pmod {49}. $$
$$  y \equiv 30, 18 \pmod {49}. $$
Each of the two solutions 
$$ (1,30) \; \; \;  (1,18)  \pmod {49}  $$
can be multiplied by any invertible element $t$ to give all
$$ (t,30t) \; \; \;  (t,18t)  \pmod {49}  $$
There are $42$ values of $t,$ giving $84 $ solutions with both $x,y \neq 0 \pmod 7.$ In turn, given any $(x,y),$ there is an element $1/x \pmod {49}$
and we arrive at a fixed solution $(1, y/x) \pmod {42}.$
If $x \equiv 0 \pmod 7,$ it follows that $y \equiv 0 \pmod 7.$ Furthermore these are all solutions, giving another $7 \cdot 7 = 49.$
Together $84 + 49.$ 
</s>