What is the relation between the length of period of simple continued fraction expansion of quadratic algebraic numbers $\sqrt{A}$ and the integer $A$

What is the relation between the length of period of simple continued fraction expansion of quadratic algebraic numbers and the integer

As we know,$\sqrt{2} = [1;2,2,2,2,…]$; while $\sqrt{14}= [3;1,2,1,6,1,2,1,6…]$,let $L$ the length of period of simple continued fraction expansion of quadratic algebraic numbers be the number of integers in sequence of one periods, that is $L=i$ for quadratic algebraic number$\sqrt{A}$,where $\sqrt{A} = [a_0;a_1,a_2,\cdots,a_i,a_1,a_2,\cdots,a_i,…]$.

We know different quadratic algebraic numbers may have different lengths of period of simple continued fraction expansion What is the relation between the length of period of simple continued fraction expansion of quadratic algebraic numbers and the corresponding integer $A$?It is looks like $L$ is relevent to the prime factors of $A$.Is there any formula?

Since we can decide there is a period or cycle,we possibly can compute the the length,otherwise we may get a set of increasing random sequences elements of which are period of quadratic algebraic numbers and have another example of undecidable question.

• Are you expecting there to be a simple rule? There isn't. – KConrad Aug 27 '14 at 5:21
• @KConrad，no,but if there is a simple rule,that is a surprise to me.But I don't think there is such a rule.Maybe there is a simple inequality . – XL _At_Here_There Aug 27 '14 at 5:28
• See here for some references. – Andrés E. Caicedo Aug 27 '14 at 5:35
• @AndresCaicedo,thank you,I am reading the blog and there are useful theorems – XL _At_Here_There Aug 27 '14 at 5:45
• @AndresCaicedo,Yes,there is a simple inequality.And possibly,some theorems cited from literatures may be unified? – XL _At_Here_There Aug 27 '14 at 5:59