Continued fraction
√13 = [3; overline{1, 1, 1, 1, 6}]
The period length is 5, which is odd, so the fundamental +1 solution uses two periods, or 10 continued-fraction terms in total.
D may be from 2 through 10,000,000 and cannot be a perfect square. Commas, spaces, or underscores may group its digits in threes.
For D = 13, select Solve equation to find the fundamental solution (649, 180), its continued-fraction working, and later positive pairs.
The standard Pell equation asks for integer pairs (x, y) satisfying:
x² − Dy² = 1
Here D is a fixed positive integer that is not a perfect square. Every such D has infinitely many solutions. This solver lists the nontrivial positive pairs with x > 1 and y > 0.
The two trivial solutions (1, 0) and (−1, 0) always exist. Because the variables are squared, every listed positive pair also represents the four signed pairs (x, y), (x, −y), (−x, y), and (−x, −y).
Convergent recurrence
p₋₂ = 0, p₋₁ = 1
q₋₂ = 1, q₋₁ = 0
pₖ = aₖpₖ₋₁ + pₖ₋₂
qₖ = aₖqₖ₋₁ + qₖ₋₂
Every step uses integer arithmetic. The tool verifies the final identity directly instead of relying on a decimal approximation to √D.
Once the fundamental positive solution (x1, y1) is known, all positive solutions come from powers of x1 + y1√D:
xₙ + yₙ√D = (x₁ + y₁√D)ⁿ
xₙ₊₁ = x₁xₙ + D·y₁yₙ
yₙ₊₁ = x₁yₙ + y₁xₙ
The recurrence avoids floating-point square roots and keeps arbitrarily large displayed results exact with JavaScript BigInt.
√13 = [3; overline{1, 1, 1, 1, 6}]
The period length is 5, which is odd, so the fundamental +1 solution uses two periods, or 10 continued-fraction terms in total.
The required convergent is 649/180, giving:
649² − 13(180²)
= 421,201 − 421,200
= 1
The next positive pair is (842,401, 233,640), obtained from (649 + 180√13)².
| Case | How the solver handles it |
|---|---|
| D nonsquare, 2–10,000,000 | Calculates the full period, fundamental pair, and requested positive solutions exactly. |
| D is a perfect square | Stops with an explanation. In that degenerate case, factoring shows that only the trivial pairs (±1, 0) solve the +1 equation. |
| D ≤ 1 or above the limit | Rejects the value before calculation to keep browser work predictable. |
| Exceptionally large solution text | Stops the on-page sequence at a 120,000-character budget and reports how many exact pairs were rendered. |
This tool solves the standard +1 Pell equation only. Generalized equations x² − Dy² = N need additional solvability tests and can have several unrelated families of solutions.
Yes. Every positive nonsquare integer D has infinitely many integer solutions to x² − Dy² = 1. The smallest pair with x > 1 and y > 0 is called the fundamental solution.
If D = k², then (x − ky)(x + ky) = 1. Integer factors force y = 0 and x = ±1, so there is no infinite nontrivial Pell sequence.
An even period reaches the fundamental +1 solution after one period. An odd period first corresponds to the negative equation and needs two periods to reach the +1 solution.
The table lists positive nontrivial pairs in increasing order. Apply either sign independently to x and y, and include (±1, 0), to obtain every integer solution of the standard equation.
The size is controlled by the continued fraction of √D, not simply by the size of D. For example, D = 61 already has the fundamental pair (1,766,319,049, 226,153,980).
No. The negative and generalized Pell equations have different existence rules. This calculator deliberately fixes the right-hand side at +1.
Yes. The continued-fraction expansion and BigInt recurrences run entirely in your browser. The tool does not upload, store, or place D in the page URL.