These are what are called "units of the integer ring $\Bbb Z[\sqrt 2]$ of norm $-1$." It is known that they are exactly the integer coefficients of the numbers $p+q\sqrt 2$ when

$$p+q\sqrt 2= (1+\sqrt{2})^{2n+1}, n\in\Bbb Z.\qquad (*)$$

So yes, there is an infinite number, and to generate them you need only perform the procedure from $(*)$, that is--using the binomial theorem--we have for each $n\in\Bbb Z$

$$\begin{cases} p = \displaystyle\sum_{k=0}^n{2n+1\choose 2k}2^k \\ q = \displaystyle\sum_{k=0}^{n}{2n+1\choose 2k+1}2^{k-1}\end{cases}.$$


Posted some time ago was the very similar question of finding p, q, such that $p^2 ± 1 = 2 q^2$. Here is how you could solve that one without any deep maths whatsoever:

Step 1: Find the first few solutions. $1^2 = 2·0^2 + 1$, $1^2 = 2·1^2 - 1$, $3^2 = 2·2^2 + 1$, $7^2 = 2·5^2 - 1$, $17^2 = 2·12^2+1$, $41^2 = 2·29^2 - 1$ and so on.

Step 2: Find a pattern.

Step 3: Prove by induction that if p, q are a solution then ... and ... are a solution. This gives you an infinite number of solution.

Step 4: Prove backwards that if ... and ... are a solution, then p and q are a solution. Prove that p and q get smaller when you do this calculation, and show that therefore starting with any solution, you can trace it back to the solution $1^2 = 2·0^2 + 1$. Conclude that the solution that you found is the only one.

You can do this and leave out every second solution, or just go straight to the solution of your problem - the pattern will be harder to find.


By stealing others people work, i.e. Adam Hughes here, we can even derive a recursion formula. Just observe that from:

$$p + q \sqrt{2} = (1 + \sqrt{2})^{2n+1}$$

We have:

$$p’ + q’ \sqrt{2} = (1 + \sqrt{2})^{2(n+1)+1}$$

$$= (1 + \sqrt{2})^{2n+1} (1 + \sqrt{2})^2$$

$$= (p + q \sqrt{2})\,(3 + 2 \sqrt{2})$$

$$= (3 p + 4 q) + (2 p + 3 q) \sqrt{2}$$

Hence:

$$p’ = 3 p + 4 q$$

$$q’ = 2 p + 3 q$$

Here are some example numbers, computing $p/q$ we get approximations of $\sqrt{2}$:

     P       Q          P/Q
     1       1  1.000000000
     7       5  1.400000000
    41      29  1.413793103
   239     169  1.414201183
  1393     985  1.414213198
  8119    5741  1.414213552
 47321   33461  1.414213562