# Cycle length and total count of Gauss reduced indefinite binary quadratic forms

Wikipedia lists two articles on maximum length for the continued fraction of $\sqrt n,$ Hickerson 1973 and Cohn 1977. There is a mess in the references, Cohn is not visible, just the link.

Hmmm. This guy does a review of one of the (Russian) references, http://www.jpr2718.org/podstotalc.pdf

I did my own modelling for two items, longest Gauss-Lagrange cycles of reduced forms, and largest number of reduced forms for a discriminant (positive but not a square). Reduced forms are $\langle a,b,c\rangle$ such that $\gcd(a,b,c) = 1, \;$ $d = b^2 - 4ac, \; \;$ $ac < 0, \; b > |a+c|.$ This equivalent version of reduction is in Franz's book, Theorem 1.36, formula 1.34. It is page numbered 37, pdf page 43.

Details: the longest individual cycles were all prime discriminant, class number one. The largest form count was sometimes composite discriminant, class number not one.

Hickerson and Cohn say that the period length for $\sqrt d$ is below $\sqrt d \log d.$ My own computations say this for both cycles of arbitrary reduced forms and total count of forms, where the latter has slightly larger implied constant (maybe over Cohn's $\frac{7}{2 \pi^2}.$ So the questions are, is $C_j \sqrt d \log d$ a provable upper bound for my two related problems?

Best length of individual cycle: let d be the discriminant, a,b,c the coefficients of the form considered, L the length of the cycle, cohn = sqrt(d) log(d), and ratio = L/cohn

     d           a           b           c              L    cohn       ratio
5           1           1          -1              2   3.598813   0.5557389
17           1           3          -2              6   11.68164   0.5136266
41           1           5          -4             10   23.77846   0.4205486
73           1           7          -6             18   36.6577    0.4910291
193           1          13          -6             30   73.11163   0.4103314
241           1          15          -4             38   85.14695   0.4462873
337           1          17         -12             42   106.8425   0.3931019
409           1          19         -12             54   121.6199   0.4440064
601           1          23         -18             66   156.8635   0.420748
769           1          27         -10             70   184.274    0.3798691
1033           1          31         -18             78   223.061    0.3496802
1201           1          33         -28            106   245.7386   0.4313526
1609           1          39         -22            118   296.1642   0.3984276
1801           1          41         -30            130   318.1208   0.4086498
2161           1          45         -34            146   356.939    0.4090335
2521           1          49         -30            170   393.2619   0.4322819
3361           1          57         -28            178   470.7496   0.3781203
3529           1          59         -12            198   485.2689   0.4080212
4201           1          63         -58            210   540.7576   0.3883441
4561           1          67         -18            214   569.0039   0.3760958
5209           1          71         -42            238   617.6703   0.3853188
5569           1          73         -60            258   643.6448   0.4008422
6841           1          81         -70            290   730.3893   0.3970485
7561           1          85         -84            306   776.5653   0.3940428
8089           1          89         -42            330   809.2934   0.4077631
9241           1          95         -54            346   877.8031   0.3941658
12049           1         109         -42            378   1031.46    0.3664707
12289           1         109        -102            390   1043.869   0.3736102
12601           1         111         -70            394   1059.851   0.3717503
13729           1         117         -10            426   1116.317   0.3816119
15649           1         125          -6            454   1208.197   0.3757665
16921           1         129         -70            474   1266.507   0.3742578
18481           1         135         -64            502   1335.59    0.3758639
19009           1         137         -60            522   1358.418   0.3842705
20161           1         141         -70            530   1407.329   0.3765999
21121           1         145         -24            542   1447.206   0.3745147
21961           1         147         -88            566   1481.483   0.3820495
24049           1         155          -6            578   1564.397   0.3694714
26041           1         161         -30            590   1640.741   0.3595937
26161           1         161         -60            602   1645.26    0.3658996
28081           1         167         -48            622   1716.434   0.3623793
28729           1         169         -42            630   1739.992   0.3620706
31249           1         175        -156            674   1829.564   0.3683938
33049           1         181         -72            702   1891.701   0.3710947
33289           1         181        -132            714   1899.877   0.3758138
38329           1         195         -76            722   2066.233   0.3494282
40609           1         201         -52            750   2138.444   0.3507222
43201           1         207         -88            766   2218.496   0.345279
43801           1         209         -30            794   2236.735   0.3549817
47041           1         215        -204            842   2333.464   0.3608369
47881           1         217        -198            862   2358.079   0.3655518
48049           1         219         -22            878   2362.98    0.3715648
49009           1         221         -42            886   2390.848   0.3705798
51769           1         227         -60            914   2469.714   0.3700834
53881           1         231        -130            966   2528.87    0.3819888
59929           1         243        -220            974   2693.068   0.3616693
61681           1         247        -168           1002   2739.307   0.365786
65521           1         255        -124           1006   2838.747   0.3543817
66361           1         257         -78           1022   2860.168   0.3573217
67369           1         259         -72           1042   2885.721   0.3610882
69001           1         261        -220           1074   2926.753   0.3669596
70849           1         265        -156           1086   2972.721   0.3653219
80809           1         283        -180           1142   3212.198   0.3555198
87481           1         295        -114           1242   3365.64    0.3690234
101641           1         317        -288           1246   3675.646   0.338988
101929           1         319         -42           1270   3681.754   0.3449443
102001           1         319         -60           1298   3683.279   0.3524034
d           a           b           c              L    cohn       ratio


==========================================

Best total count of reduced forms:

file named many_reduced_binary.txt
d       red  red/(sqrt(d) log(d))
5         2       0.555739              5 = 5
12         4       0.464686             12 = 2^2 * 3
17         6       0.513627             17 = 17
28         8       0.453711             28 = 2^2 * 7
41        10       0.420549             41 = 41
57        12       0.393129             57 = 3 * 19
73        18       0.491029             73 = 73
105        20       0.419385            105 = 3 * 5 * 7
145        28       0.467229            145 = 5 * 29
193        30       0.410331            193 = 193
217        32       0.403781            217 = 7 * 31
241        38       0.446287            241 = 241
265        40       0.440376            265 = 5 * 53
337        42       0.393102            337 = 337
385        44       0.376677            385 = 5 * 7 * 11
409        54       0.444006            409 = 409
481        56       0.413445            481 = 13 * 37
505        60        0.42894            505 = 5 * 101
601        66       0.420748            601 = 601
649        68       0.412209            649 = 11 * 59
721        72       0.407471            721 = 7 * 103
865        80       0.402217            865 = 5 * 173
889        84       0.414909            889 = 7 * 127
1009        90       0.409635           1009 = 1009
1081        92       0.400561           1081 = 23 * 47
1129       102       0.431871           1129 = 1129
1201       106       0.431353           1201 = 1201
1489       114       0.404377           1489 = 1489
1609       118       0.398428           1609 = 1609
1801       130        0.40865           1801 = 1801
1969       140       0.415943           1969 = 11 * 179
2161       146       0.409034           2161 = 2161
2521       170       0.432282           2521 = 2521
3241       180       0.391135           3241 = 7 * 463
3529       198       0.408021           3529 = 3529
3649       208       0.419803           3649 = 41 * 89
4201       210       0.388344           4201 = 4201
4321       216       0.392529           4321 = 29 * 149
4369       220       0.397072           4369 = 17 * 257
4729       230       0.395273           4729 = 4729
5209       238       0.385319           5209 = 5209
5401       240       0.379981           5401 = 11 * 491
5569       258       0.400842           5569 = 5569
6049       264       0.389817           6049 = 23 * 263
6169       272       0.396809           6169 = 31 * 199
6769       276       0.380341           6769 = 7 * 967
6841       290       0.397049           6841 = 6841
7561       306       0.394043           7561 = 7561
8089       330       0.407763           8089 = 8089
9241       346       0.394166           9241 = 9241
9529       352       0.393572           9529 = 13 * 733
10921       380       0.391059          10921 = 67 * 163
12289       390        0.37361          12289 = 12289
12601       394        0.37175          12601 = 12601
12961       404       0.374736          12961 = 13 * 997
13729       426       0.381612          13729 = 13729
14281       434        0.37962          14281 = 14281
14569       448       0.387165          14569 = 17 * 857
15409       472       0.394326          15409 = 19 * 811
15961       480       0.392582          15961 = 11 * 1451
17329       492       0.382933          17329 = 13 * 31 * 43
18001       516       0.392515          18001 = 47 * 383
19009       522        0.38427          19009 = 19009
20161       530         0.3766          20161 = 20161
20689       532       0.372195          20689 = 17 * 1217
21121       542       0.374515          21121 = 21121
21961       566        0.38205          21961 = 21961
23689       574       0.370245          23689 = 23689
23809       576       0.370412          23809 = 29 * 821
23881       584       0.374878          23881 = 11 * 13 * 167
25249       596       0.370028          25249 = 7 * 3607
26161       602         0.3659          26161 = 26161
27049       616       0.367007          27049 = 11 * 2459
28081       622       0.362379          28081 = 28081
28681       660       0.379691          28681 = 23 * 29 * 43
31201       680       0.372014          31201 = 41 * 761
33049       702       0.371095          33049 = 33049
33289       714       0.375814          33289 = 33289
37129       752         0.3709          37129 = 107 * 347
37801       756       0.368915          37801 = 103 * 367
40441       768       0.360025          40441 = 37 * 1093
40681       776       0.362499          40681 = 17 * 2393
43801       794       0.354982          43801 = 43801
43849       808       0.361006          43849 = 13 * 3373
44209       812       0.361037          44209 = 11 * 4019
44641       826       0.365148          44641 = 44641
45049       848       0.372856          45049 = 19 * 2371
46561       852        0.36735          46561 = 101 * 461
47881       862       0.365552          47881 = 47881
48049       878       0.371565          48049 = 48049
49009       886        0.37058          49009 = 49009
50521       912       0.374649          50521 = 19 * 2659
51769       914       0.370083          51769 = 51769
53881       966       0.381989          53881 = 53881
58969       984       0.368886          58969 = 109 * 541
61681      1002       0.365786          61681 = 61681
63361      1022       0.367213          63361 = 63361
65209      1040       0.367392          65209 = 61 * 1069
65641      1052       0.370186          65641 = 41 * 1601
69001      1074        0.36696          69001 = 69001
70849      1086       0.365322          70849 = 70849
74281      1100       0.359858          74281 = 59 * 1259
74881      1128       0.367273          74881 = 103 * 727
77401      1144       0.365291          77401 = 17 * 29 * 157
81481      1180       0.365564          81481 = 17 * 4793
84529      1200       0.363814          84529 = 137 * 617
85801      1212       0.364239          85801 = 239 * 359
86641      1252       0.374111          86641 = 23 * 3767
92569      1286       0.369611          92569 = 92569
95209      1296       0.366384          95209 = 19 * 5011
100321      1320       0.361886         100321 = 13 * 7717
105169      1328       0.354137         105169 = 251 * 419
105361      1330       0.354291         105361 = 105361
109729      1360       0.353756         109729 = 197 * 557
111721      1378       0.354679         111721 = 111721
114409      1396       0.354341         114409 = 191 * 599
117049      1496       0.374683         117049 = 67 * 1747
127009      1516       0.361968         127009 = 107 * 1187
130729      1558       0.365766         130729 = 130729
138121      1584       0.360101         138121 = 37 * 3733
144169      1610        0.35696         144169 = 144169
153169      1672       0.357826         153169 = 89 * 1721
155401      1676       0.355666         155401 = 19 * 8179
157249      1680       0.354064         157249 = 67 * 2347
157921      1736       0.364956         157921 = 79 * 1999
173209      1814       0.361346         173209 = 173209
180049      1852       0.360682         180049 = 401 * 449
185641      1902       0.363879         185641 = 185641
197521      1910       0.352448         197521 = 197521
204649      1916       0.346336         204649 = 19 * 10771
204961      1948       0.351809         204961 = 97 * 2113
210961      1978       0.351281         210961 = 210961
220081      1992       0.345168         220081 = 29 * 7589
223609      2104       0.361221         223609 = 311 * 719
242449      2114       0.346277         242449 = 242449
251329      2144       0.343934         251329 = 13 * 19333
259009      2170       0.342077         259009 = 259009
261361      2200       0.344992         261361 = 31 * 8431
266809      2216       0.343367         266809 = 367 * 727
268129      2272       0.351037         268129 = 73 * 3673
279889      2316       0.349039         279889 = 19 * 14731
287401      2396       0.355594         287401 = 31 * 73 * 127
295201      2398       0.350411         295201 = 295201
306289      2412       0.345008         306289 = 17 * 43 * 419
314161      2446       0.344768         314161 = 314161
315121      2452       0.345004         315121 = 181 * 1741
316369      2476       0.347584         316369 = 19 * 16651
320401      2534       0.353128         320401 = 320401
328441      2600       0.357165         328441 = 53 * 6197
349801      2602       0.344645         349801 = 349801
357361      2656       0.347474         357361 = 191 * 1871
360721      2664        0.34664         360721 = 137 * 2633
367249      2692       0.346671         367249 = 181 * 2029
373129      2700       0.344523         373129 = 23 * 16223
383881      2716       0.340922         383881 = 103 * 3727
389041      2730       0.340046         389041 = 389041
393121      2782       0.344441         393121 = 393121
394969      2866       0.353881         394969 = 394969
415801      2878       0.344971         415801 = 415801
416329      2936       0.351665         416329 = 263 * 1583
425569      2952        0.34913         425569 = 23 * 18503
457081      2996       0.340027         457081 = 83 * 5507
463849      2998       0.337382         463849 = 463849
465481      3008       0.337823         465481 = 19 * 24499
469249      3032       0.338939         469249 = 11 * 29 * 1471
469561      3038       0.339479         469561 = 469561
483289      3154       0.346635         483289 = 483289
503281      3212       0.344859         503281 = 463 * 1087
511681      3244       0.344989         511681 = 23 * 22247
515761      3330       0.352519         515761 = 515761
528889      3336       0.348078         528889 = 167 * 3167
540409      3348       0.345023         540409 = 439 * 1231
552841      3386         0.3444         552841 = 552841
563161      3432       0.345382         563161 = 233 * 2417
579049      3448       0.341481         579049 = 31 * 18679
600601      3542       0.343493         600601 = 600601
601129      3560       0.345064         601129 = 509 * 1181
605641      3570       0.344549         605641 = 605641
628489      3668       0.346549         628489 = 41 * 15329
663961      3706       0.339262         663961 = 663961
677161      3728       0.337438         677161 = 17 * 61 * 653
685441      3812       0.342641         685441 = 31 * 22111
691681      3846       0.343902         691681 = 691681
702529      3866       0.342615         702529 = 702529
722929      3920       0.341737         722929 = 79 * 9151
723529      3950       0.344188         723529 = 723529
766921      4004       0.337423         766921 = 17 * 197 * 229
772489      4024       0.337704         772489 = 31 * 24919
786241      4134       0.343441         786241 = 786241
799681      4136       0.340283         799681 = 37 * 21613
819289      4174       0.338671         819289 = 819289
825841      4256       0.343751         825841 = 379 * 2179
878641      4398       0.342822         878641 = 878641
914281      4416       0.336472         914281 = 337 * 2713
924169      4444       0.336525         924169 = 881 * 1049
928489      4528       0.341971         928489 = 17 * 54617
969049      4590       0.338269         969049 = 969049
979969      4698       0.344014         979969 = 979969
1007161      4706       0.339243        1007161 = 1007161
1057081      4792       0.336012        1057081 = 157 * 6733
1083289      4966       0.343368        1083289 = 1083289
1162561      4988        0.33124        1162561 = 103 * 11287
1171921      5070       0.335145        1171921 = 1171921
1195489      5118        0.33449        1195489 = 1195489
1201561      5300       0.345384        1201561 = 541 * 2221
1264561      5322       0.336838        1264561 = 1264561
1267249      5424       0.342878        1267249 = 31 * 40879
1354369      5468       0.332783        1354369 = 73 * 18553
1354609      5480       0.333479        1354609 = 71 * 19079
1368481      5532       0.334692        1368481 = 29 * 47189
1379569      5576       0.335803        1379569 = 43 * 32083
1391329      5624       0.337057        1391329 = 83 * 16763
1433041      5826       0.343328        1433041 = 1433041
1466089      5856       0.340636        1466089 = 23 * 63743
1538161      5864       0.331892        1538161 = 1063 * 1447
1552849      5900       0.332125        1552849 = 229 * 6781
1577689      5910       0.329692        1577689 = 1577689
1609609      5920         0.3265        1609609 = 23 * 47 * 1489
1627921      6120       0.335362        1627921 = 571 * 2851
1642369      6132       0.334331        1642369 = 433 * 3793
1672609      6158       0.332276        1672609 = 1672609
1699681      6210       0.332031        1699681 = 1699681
1701001      6232        0.33306        1701001 = 31 * 37 * 1483
1719481      6240       0.331441        1719481 = 19 * 90499
1720489      6304       0.334729        1720489 = 97 * 17737
1739929      6312       0.333015        1739929 = 83 * 20963
1785169      6444       0.335045        1785169 = 149 * 11981
1848289      6534       0.333069        1848289 = 1848289
1851529      6604       0.336302        1851529 = 167 * 11087
1906129      6768       0.338999        1906129 = 37 * 51517
2031649      6964       0.336386        2031649 = 53 * 38333
2144041      7062       0.330832        2144041 = 2144041
2159161      7128       0.332592        2159161 = 1117 * 1933
2213929      7156       0.329177        2213929 = 433 * 5113
2222089      7226       0.331703        2222089 = 2222089
2235601      7236       0.331019        2235601 = 569 * 3929
2293729      7402       0.333709        2293729 = 2293729
2356201      7408       0.328919        2356201 = 479 * 4919
2413321      7604       0.333058        2413321 = 23 * 317 * 331
2490049      7620       0.327878        2490049 = 23 * 108263
2519449      7636       0.326384        2519449 = 73 * 34513
2545321      7772       0.330275        2545321 = 41 * 62081
2602681      7886       0.330907        2602681 = 2602681
2636209      7892       0.328761        2636209 = 31 * 277 * 307
2675401      7952       0.328497        2675401 = 281 * 9521
2770681      8060       0.326412        2770681 = 53 * 61 * 857
2784961      8234       0.332487        2784961 = 2784961
2922529      8254       0.324302        2922529 = 2922529
2938849      8348       0.326961        2938849 = 59 * 49811
2959441      8468        0.33035        2959441 = 383 * 7727
2985889      8548       0.331793        2985889 = 31 * 61 * 1579
3100969      8596       0.326578        3100969 = 1319 * 2351
3147769      8604       0.324118        3147769 = 1123 * 2803
3197041      8664       0.323518        3197041 = 397 * 8053
3199681      8708       0.325009        3199681 = 41 * 78041
3206641      8788       0.327591        3206641 = 643 * 4987
3267289      8810       0.324942        3267289 = 3267289
3335929      9140       0.333166        3335929 = 101 * 33029
3395401      9220       0.332734        3395401 = 709 * 4789
3528001      9242       0.326369        3528001 = 3528001
3581449      9356       0.327593        3581449 = 89 * 40241
3674449      9412       0.324805        3674449 = 227 * 16187
3712921      9628       0.330306        3712921 = 43 * 79 * 1093
3818929      9818       0.331499        3818929 = 3818929
3864169      9860       0.330706        3864169 = 37 * 181 * 577
4064449      9904       0.322818        4064449 = 883 * 4603
4217929      9910       0.316312        4217929 = 4217929
4269841     10050       0.318569        4269841 = 4269841
4270561     10092        0.31987        4270561 = 47 * 90863
4275049     10150       0.321518        4275049 = 4275049
4280329     10378        0.32851        4280329 = 4280329
4499881     10420       0.320642        4499881 = 23 * 179 * 1093
4586761     10660       0.324501        4586761 = 563 * 8147
4701841     10770        0.32329        4701841 = 4701841
4708729     10830       0.324822        4708729 = 4708729
4724281     10932       0.327271        4724281 = 43 * 181 * 607
4861081     11056       0.325688        4861081 = 859 * 5659
4962049     11062       0.322102        4962049 = 4962049
5013649     11082       0.320805        5013649 = 5013649
5048761     11220       0.323522        5048761 = 37 * 136453
5098129     11354       0.325591        5098129 = 5098129
5343529     11410       0.318626        5343529 = 5343529
5368609     11438       0.318564        5368609 = 5368609
5390449     11566       0.321392        5390449 = 5390449
5505361     11602       0.318577        5505361 = 5505361
5542681     11684       0.319607        5542681 = 293 * 18917
5587201     11744       0.319801        5587201 = 73 * 76537
5634841     11984       0.324777        5634841 = 37 * 152293
5730169     12104       0.324938        5730169 = 233 * 24593
5815681     12308       0.327664        5815681 = 71 * 101 * 811
6016921     12418       0.324309        6016921 = 6016921
6080881     12430       0.322692        6080881 = 6080881
6104641     12586       0.326024        6104641 = 6104641
6195289     12648       0.324918        6195289 = 67 * 92467
6406009     12912       0.325503        6406009 = 199 * 32191
6589969     13026       0.323177        6589969 = 6589969
6763849     13046       0.318957        6763849 = 6763849
6783529     13194       0.322047        6783529 = 6783529
6868801     13434       0.325605        6868801 = 6868801
6969169     13504       0.324637        6969169 = 967 * 7207
7209409     13856       0.326799        7209409 = 127 * 56767
7478689     14180       0.327604        7478689 = 43 * 173923
7623529     14206       0.324679        7623529 = 7623529
7880161     14332       0.321509        7880161 = 47 * 167663
7926361     14420        0.32242        7926361 = 359 * 22079
8092681     14484       0.320087        8092681 = 79 * 89 * 1151
8254801     14666       0.320511        8254801 = 8254801
8281729     14724        0.32119        8281729 = 47 * 176207
8465209     15118       0.325743        8465209 = 8465209
8895769     15350       0.321638        8895769 = 8895769
9033649     15706       0.326263        9033649 = 9033649
9257329     15854       0.324838        9257329 = 9257329
9850801     15906       0.314714        9850801 = 9850801
9853561     15992       0.316366        9853561 = 173 * 56957
10018849     16024       0.314049       10018849 = 47 * 59 * 3613
10058161     16340       0.319538       10058161 = 41 * 245321
10319761     16586       0.319702       10319761 = 10319761


=======================================================

• You have seven columns of numbers in that first table, and no heading on any of them. – Gerry Myerson Nov 20 '17 at 5:01