Skip to main content
3 of 4
code sample button
Will Jagy
  • 25.7k
  • 2
  • 65
  • 121

Hi, David. This is roughly Robin's comment, just with longer discussions, and, I am afraid, links to my own answers. That's life.

I think you would probably enjoy J.H. Conway, "The Sensual Quadratic Form," especially PSL_2(Z) on pages 27-33.

I always like "The Markoff and Lagrange Spectra" by Thomas W. Cusick and Mary E. Flahive and "Binary Quadratic Forms" by Duncan A. Buell.

On particular issues I think you are raising, answers by me and by Dror in:

Reasons for switching from simple continued fractions for $\sqrt D$ to reduced forms: Upper bound of period length of continued fraction representation of very composite number square root

Numbers (here primes) occurring as "diagonal" coefficients: Primes as the first coefficient of a reduced indefinite quadratic form

Other: Numbers characterized by extremal properties

In my language, I think you are asking mostly about small numbers occurring as diagonal coefficients, just not necessarily prime. For me, such numbers need also to be primitively represented by the forms in the cycle (for you I guess it is by $ x^2 - D y^2 ,$ using $a_0 = \lfloor \sqrt D \rfloor$ your quadratic form is equivalent to the reduced form $\langle 1,\; 2 a_0, \; a_0^2 - D \rangle.$ )

phoebus:~/Cplusplus> ./Pell
Input n for Pell
67

0  form   1 16 -3   delta  -5
1  form   -3 14 6   delta  2
2  form   6 10 -7   delta  -1
3  form   -7 4 9   delta  1
4  form   9 14 -2   delta  -7
5  form   -2 14 9   delta  1
6  form   9 4 -7   delta  -1
7  form   -7 10 6   delta  2
8  form   6 14 -3   delta  -5
9  form   -3 16 1   delta  16
10  form   1 16 -3

 disc   268
Automorph, written on right of Gram matrix:
-1106  -17901
-5967  -96578


 Pell automorph
-48842  -399789
-5967  -48842

Pell unit
-48842^2 - 67 * -5967^2 = 1

=========================================
phoebus:~/Cplusplus>

Anyway, let me know if you want to see any more worked examples. Or the computer program. It is C++ so the numbers are bounded. Easy enough in other languages, of course.

Will Jagy
  • 25.7k
  • 2
  • 65
  • 121