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?