# Length of continued fraction

Why is the periodic length of simple continued fraction expansion of any quadratic irrational i.e irrational of the form $$\dfrac{P+\sqrt{R}}{Q}$$ is less than $2R$?

The asymptotic of Cohn is $$\frac{7}{2 \pi^2} \sqrt R \log r + O( \sqrt R)$$
• both those results are of specifically for $R^{1/2}$ in other words $P=0$ and $Q=1$. I am interested in how the behaviour of different $P$ and $Q$ play the role here in the upper bound for period length. Mar 9 '17 at 21:03
As I expected, allowing general reduced forms does not much change the maximum length of continued fraction periodic section. Still $\sqrt d \log d$
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$./bigCycle discr a b c length sqrt(d) * log(d) length/(sqrt(d)*log(d)) 5 1 1 -1 2 3.598812577768002 0.5557388601882701 17 2 1 -2 6 11.68163787745321 0.5136266046716472 41 2 3 -4 10 23.77846330776795 0.4205486229521485 73 4 3 -4 18 36.65770153430481 0.4910291493086477 193 6 5 -7 30 73.11162868318813 0.4103314416643332 241 6 5 -9 38 85.14694576902021 0.4462872937695657 337 6 7 -12 42 106.8425201478901 0.39310192179915 409 10 3 -10 54 121.6198623622381 0.4440064225624921 601 12 5 -12 66 156.8634830000024 0.4207480207487106 769 12 7 -15 70 184.2740159127738 0.3798690751556343 1033 16 3 -16 78 223.0609527063442 0.34968020648009 1201 16 7 -18 106 245.7386488282813 0.4313525792764952 1609 20 3 -20 118 296.1641899980161 0.3984276424532974 1801 20 11 -21 130 318.1208060005595 0.4086497882184147 2161 22 7 -24 146 356.9389573465163 0.4090335251869502 2521 24 5 -26 170 393.2619129923604 0.4322818823375415 3361 27 11 -30 178 470.7495953275685 0.3781203462875835 3529 29 7 -30 198 485.2689323717215 0.4080211750467672 4201 30 11 -34 210 540.757607508973 0.3883440511680927 4561 32 9 -35 214 569.0039278467663 0.3760958220619359 5209 36 5 -36 238 617.6703105346307 0.3853188277642756 5569 30 17 -44 258 643.6447653387628 0.4008422252361667 6841 40 11 -42 290 730.3892877579093 0.397048539540084 7561 42 13 -44 306 776.5652918414429 0.3940428489591553 8089 44 13 -45 330 809.2933548617549 0.4077631405442236 9241 48 5 -48 346 877.8030966889762 0.3941658457404542 12049 54 13 -55 378 1031.460429594734 0.3664706751266437 12289 52 15 -58 390 1043.868831383885 0.3736101589344005 12601 52 11 -60 394 1059.851332406444 0.3717502520899829 13729 57 7 -60 426 1116.317487006224 0.381611866658526 15649 62 5 -63 454 1208.197114835509 0.375766499046648 16921 64 5 -66 474 1266.506545484928 0.374257836795081 18481 66 23 -68 502 1335.589887969525 0.375863881960938 19009 65 17 -72 522 1358.418153458484 0.3842704830401499 20161 69 17 -72 530 1407.329053131947 0.3765999137305586 21121 70 11 -75 542 1447.206042048553 0.3745147437560353 21961 70 11 -78 566 1481.483319630914 0.3820495259717195 24049 77 5 -78 578 1564.397347456814 0.3694713500630989 26041 80 11 -81 590 1640.740555354801 0.3595937200884363 26161 77 17 -84 602 1645.260194953498 0.365899571293655 28081 77 19 -90 622 1716.433699673115 0.3623792751904466 28729 84 13 -85 630 1739.991914251457 0.3620706480529972 31249 86 17 -90 674 1829.564029933067 0.3683937752234109 33049 90 17 -91 702 1891.700622736456 0.3710946603086252 33289 90 13 -92 714 1899.877083987447 0.3758137860694979 discr a b c length sqrt(d) * log(d) length/(sqrt(d)*log(d))  • This maybe what it looks from the data above but what I am interested is like for example if$R=13$. Then one can see$L(0,1,13)=5L(5,6,13)=1$and$L(77,16,13)=6$. Here$L(P,Q,R)$denotes the period of continued fraction expansion of$\dfrac{P+\sqrt{R}}{Q}$. So how much we can change the value of$L(P,Q,R)$for a fixed$R$. Whether we can increase it arbitrarily (which is not possible considering computated data above) and can we always bring it down to$1$for some$P$and$Q\$. Mar 10 '17 at 4:48