integer solutions for $\left( a+\sqrt{b} \right) ^ n=p+q\sqrt{b}$? Given whole numbers $a$, $b$, and $n$, where $\sqrt{b} \not\in \mathbb{N}$, there should be a unique solution where $p$ and $q$ are also whole numbers.   Is there any way of expressing $p$ and $q$ in a closed form using $a$, $b$, and $n$?
 A: New approach: First let's prove inductively that there exist integers that satisfy this equality without worrying about expressing them strictly in terms of $n,a,b$. For the base case of $n=1$ it is obvious that $a = p$ and $q = 1$. In the induction step let's assume there exist integers $p_k, q_k$ such that $(a+\sqrt{b})^k = p_k+q_k\sqrt{b}$ for some $k \geq 1$. Then $$\begin{align}(a+\sqrt{b})^{k+1} &= (a+\sqrt{b})^{k}(a+\sqrt{b})\\ &= (p_k+q_k\sqrt{b})(a+\sqrt{b}) \\ &= ap_k+aq_k\sqrt{b}+p_k\sqrt{b} + q_kb \\ &= (ap_k+q_kb)+(aq_k+p_k)\sqrt{b}\end{align}$$ It is clear that $(ap_k+q_kb),(aq_k+p_k)$ are integers. Let $p_{k+1} = ap_k+q_kb$ and $q_{k+1} = aq_k+p_k$. You now have recursive definitions for the  constants you seek that can be found in terms of $n, a$ and $b$. A computer could instantly calculate these values once you provide the proper algorithm with your initial $a,b$ and designated $n$. More generally, can you work with these equations and see if you can extract a closed-form solution? Up to the case of $n = 3$ the numbers I'm getting for $p, q$ look like they lend themselves to a pattern. Taking a few more cases of $n>3$ to see a pattern, plus another little proof could get you what you want.
