Continued Fractions for Square Roots

Summary: Lagrange (Additions II, Art. 41, Scholium) reproduces Euler’s table from the New Commentaries of Petersburg vol. XI, listing the eventually-periodic continued-fraction expansion of for every non-square from 2 to 99. These expansions are useful for solving Pell-type equations since their convergents are exactly the candidate solutions.

Sources: additions-2

Last updated: 2026-05-10


Form of the Expansion

Every (with a non-square positive integer) has a continued fraction of the form

where , the period is finite, and the inner block is a palindrome (reads the same forwards and backwards). The last partial quotient before the period closes is always .

This regularity follows from the periodicity theorem (periodicity-quadratic-irrationals) plus a symmetry argument on the conjugate root.


Table for

(Modern notation: . Period length is the number of overlined entries.)

Period
21
32
51
62
74
82
101
112
122
135
144
152
171
182
196
202
216
226
234
242
261
272
284
295
302
318
324
334
344
352
371
382
392
402
413
422
4310
448
456
4612
474
482
501

Notable Entries from the Full Table ()

Period
535
587
6111
6710
737
7612
794
895
9416
9711

The original table runs to . and are notable for unusually long periods relative to nearby .


Lagrange’s Original Layout (Art. 41)

Lagrange formats each entry as a two-row block (per his algorithm of Art. 33 — see binary-quadratic-forms):

  • Upper row: — the values with sign flipped to alternate
  • Lower row: — the partial quotients of

The lower row is the modern continued fraction. The upper row encodes the auxiliary data needed to detect the period and to compute at each convergent (since for ).

Sample reading for :

P:  1 1 1 1 ...     →  P^k = 1, -1, 1, -1, ... (period 1, ±1 alternating)
μ:  1 2 2 2 ...     →  √2 = [1; 2̄]

So the convergents of satisfy , alternating — exactly the Pell solutions for .


Period Length and Pell Solutions

For each non-square :

  • If the period is even, then is never solvable; the minimal Pell solution to is given by the convergent at index .
  • If the period is odd, then both and are solvable; the minimal -solution is at index , and the minimal -solution is at index .

From the table:

PeriodSolvable: ?
21yes
32no
51yes
135yes
196no
295yes
413yes
6111yes

This gives a quick test for which admit : precisely those whose has odd CF period.


Convergents and Pell Solutions Compared with ch2.0.7-pell-equation-method

The table on pell-equation lists Euler’s minimal Pell solutions. These match exactly the convergents at the period boundary in Lagrange’s CF table:

Lagrange CF index Pell minimum
21(3, 2) at index 2 (since period odd, need 2r) — actually ,
32(2, 1): convergents , last is the answer
51(9, 4) at index 2
74(8, 3): convergents
135 (odd)(649, 180) at index 10
295 (odd)(9801, 1820) at index 10
6111 (odd)(1766319049, 226153980) at index 22 — explains the famously huge value

The huge minimal Pell solution at is forced by its CF having period 11 (odd) with non-trivial coefficients — running the convergent recurrence 22 times yields the giant .


Reference

Euler’s original table appeared in Novi Commentarii Academiae Scientiarum Petropolitanae, vol. XI (1765), supplemented in his Mémoires de l’Académie de Berlin 1768. Lagrange reproduces it as a service to his readers — anticipating modern reference tables.