Number theory and perfect squares Let $p,q,w$ be positive integers such that: $$ 1+p+q\sqrt{3} = (2+\sqrt{3})^{2w-1}$$ $\texttt{ }$ Prove that $p$ is a perfect square.
I have observed that the $RHS$ is raised to an odd power, and that the number of terms of $RHS$ equal to $2w\texttt{ }$ 
So we get that, $$1+p+q\sqrt{3} = 4^w + 3^w +(2w-2\texttt{ } terms)$$
And I can't proceed further. 
 A: First off, you can prove that $1+p-q\sqrt{3}=(2-\sqrt{3})^{2w-1}$. By using binomial to expand the right-handed side and compare the coefficients, we obtain $$p=2^{2w-1}+\binom{2w-1}{2}2^{2w-3}\cdot 3+\binom{2w-1}{4}2^{2w-5}\cdot 3^2+...+\binom{2w-1}{2w-2}2\cdot 3^{w-1}-1$$
Thus, $p$ is odd. Note also that $$(1+p)^2-3q^2=(1+p+q\sqrt{3})(1+p-q\sqrt{3})=(2+\sqrt{3})^{2w-1}(2-\sqrt{3})^{2w-1}=1$$
Let $p=l-1$ the equality above becomes, since $p$ is odd we have $l$ is even,$(l-1)(l+1)=3q^2$ and $\gcd(l-1,l+1)=1$, since $l$ is even. So we have $2$ cases, as follows.
Case 1 : $l-1 = 3x^2,l+1=y^2$ for some positive integer $x,y$. In this case we have both $x,y$ are odd since $l$ is even and thus $x^2,y^2\equiv 1\pmod 8$ and we have $y^2-3x^2=2$ which is impossible since, this will leads us to $$2=y^2-3x^2\equiv -2\pmod 8$$
Case 2 : $l-1 = x^2,l+1=3y^2$ for some positive integer $x,y$. In this case the result follows $p=l-1=x^2$ as desired $\Box$
A: Introduce $u=\sqrt{2+\sqrt 3}, v=\sqrt{2-\sqrt 3}$

Lemma 1: $(u-v)^2=2$. This is trivial, just calculate the square
Lemma 2: $uv=1$. Also trivial.
Lemma 3: $u^{2n}+v^{2n}$ for integer $n$ is also an integer.

This is also easy:
$$u^{2n}+v^{2n}=(2+\sqrt3)^n+(2-\sqrt3)^n=\\\sum_{k-0}^n\binom nk 2^{n-k}(\sqrt3)^k+\sum_{k-0}^n\binom nk 2^{n-k}(-1)^k(\sqrt3)^k=\\ \sum_{k=0}^n\binom nk 2^{n-k}(1+(-1)^k)(\sqrt3)^k$$
The root disappears both for odd and even values of $k$. So the value of the expression must be an integer.$\Box$
Now start with:
$$1+p+q\sqrt{3} = (2+\sqrt{3})^{2w-1}\tag{1}$$
I leave it up to you to prove that:
$$1+p-q\sqrt{3} = (2-\sqrt{3})^{2w-1}\tag{2}$$
From (1) and (2):
$$p=\frac12((2+\sqrt3)^{2w-1}+(2-\sqrt3)^{2w-1}-2)$$
$$p=\frac12(u^{2(2w-1)}+v^{2(2w-1)}-2(uv)^{2w-1})$$
$$p=\frac12(u^{2w-1}-v^{2w-1})^2$$
$$p=\frac{(u-v)^2}2(u^{2w-2}+u^{2w-3}v+u^{2w-4}v^2+...\\+u^{w-1}v^{w-1}+...+u^2w^{2w-4}+uv^{2w-3}+v^{2w-2})^2$$
According to lemma 1:
$$p=(u^{2w-2}+u^{2w-3}v+u^{2w-4}v^2+...+u^{w-1}v^{w-1}+...\\+u^2w^{2w-4}+uv^{2w-3}+v^{2w-2})^2$$
According to lema 2:
$$p=(u^{2w-2}+u^{2w-4}+u^{2w-6}+...+1+...+v^{2w-6}+v^{2w-4}+v^{2w-2})^2$$
$$p=((u^{2w-2}+v^{2w-2}) + (u^{2w-4} + v^{2w-4}) + (u^{2w-6}+v^{2w-6})+...+1)^2$$
According to lemma 3, expression in braces is an integer so $p$ is a perfect square.
