def testGetRepeatingRegContFrac13(self):
     self.assertEqual([3, 1, 2, 1, 6], getRepeatingRegContFrac(14))
 def testGetRepeatingRegContFrac7(self):
     self.assertEqual([2, 1, 1, 1, 4], getRepeatingRegContFrac(7))
 def testGetRepeatingRegContFrac3(self):
     self.assertEqual([1, 1, 2], getRepeatingRegContFrac(3))
Beispiel #4
0
	ds = [d for d in range(2, 101) if not sqrt(d).is_integer()]
	candidates = []
	for d in ds:
		x, y = 2, 1	
		
if __name__ == '__main__':
# 	print(sorted(generate()))
# [(3.0, 2, 2), (5.0, 6, 2), (7.0, 3, 4), (7.0, 12, 2), (8.0, 7, 3), (9.0, 5, 4), (9.0, 20, 2), (10.0, 11, 3), (11.0, 30, 2), (13.0, 42, 2), (15.0, 14, 4), (15.0, 56, 2), (17.0, 8, 6), (17.0, 18, 4), (17.0, 32, 3), (17.0, 72, 2), (19.0, 10, 6), (19.0, 40, 3), (19.0, 90, 2), (21.0, 110, 2), (23.0, 33, 4), (23.0, 132, 2), (24.0, 23, 5), (25.0, 39, 4), (25.0, 156, 2), (26.0, 27, 5), (26.0, 75, 3), (27.0, 182, 2), (28.0, 87, 3), (29.0, 210, 2), (31.0, 15, 8), (31.0, 60, 4), (31.0, 240, 2), (33.0, 17, 8), (33.0, 68, 4), (33.0, 272, 2), (35.0, 34, 6), (35.0, 136, 3), (35.0, 306, 2), (37.0, 38, 6), (37.0, 152, 3), (37.0, 342, 2), (39.0, 95, 4), (39.0, 380, 2), (41.0, 105, 4), (41.0, 420, 2), (43.0, 462, 2), (44.0, 215, 3), (45.0, 506, 2), (46.0, 235, 3), (47.0, 138, 4), (47.0, 552, 2), (48.0, 47, 7), (49.0, 24, 10), (49.0, 96, 5), (49.0, 150, 4), (49.0, 600, 2), (50.0, 51, 7), (51.0, 26, 10), (51.0, 104, 5), (51.0, 650, 2), (53.0, 78, 6), (53.0, 312, 3), (53.0, 702, 2), (55.0, 21, 12), (55.0, 84, 6), (55.0, 189, 4), (55.0, 336, 3), (55.0, 756, 2), (57.0, 203, 4), (57.0, 812, 2), (59.0, 870, 2), (61.0, 930, 2), (62.0, 427, 3), (63.0, 62, 8), (63.0, 248, 4), (63.0, 992, 2), (64.0, 455, 3), (65.0, 66, 8), (65.0, 264, 4), (71.0, 35, 12), (71.0, 140, 6), (71.0, 315, 4), (71.0, 560, 3), (73.0, 37, 12), (73.0, 148, 6), (73.0, 333, 4), (73.0, 592, 3), (74.0, 219, 5), (76.0, 231, 5), (79.0, 390, 4), (80.0, 79, 9), (80.0, 711, 3), (81.0, 410, 4), (82.0, 83, 9), (82.0, 747, 3), (87.0, 473, 4), (89.0, 55, 12), (89.0, 220, 6), (89.0, 495, 4), (89.0, 880, 3), (91.0, 230, 6), (91.0, 920, 3), (95.0, 141, 8), (95.0, 564, 4), (97.0, 48, 14), (97.0, 147, 8), (97.0, 192, 7), (97.0, 588, 4), (99.0, 50, 14), (99.0, 98, 10), (99.0, 200, 7), (99.0, 392, 5), (101.0, 102, 10), (101.0, 408, 5), (103.0, 663, 4), (105.0, 689, 4), (107.0, 318, 6), (109.0, 330, 6), (111.0, 770, 4), (113.0, 798, 4), (119.0, 885, 4), (120.0, 119, 11), (121.0, 915, 4), (122.0, 123, 11), (124.0, 615, 5), (125.0, 434, 6), (126.0, 635, 5), (127.0, 28, 24), (127.0, 63, 16), (127.0, 112, 12), (127.0, 252, 8), (127.0, 448, 6), (129.0, 65, 16), (129.0, 260, 8), (143.0, 142, 12), (143.0, 568, 6), (145.0, 146, 12), (145.0, 584, 6), (146.0, 435, 7), (148.0, 447, 7), (149.0, 222, 10), (149.0, 888, 5), (151.0, 57, 20), (151.0, 228, 10), (151.0, 912, 5), (159.0, 395, 8), (161.0, 45, 24), (161.0, 80, 18), (161.0, 180, 12), (161.0, 320, 9), (161.0, 405, 8), (161.0, 720, 6), (163.0, 82, 18), (163.0, 328, 9), (163.0, 738, 6), (168.0, 167, 13), (170.0, 19, 39), (170.0, 171, 13), (179.0, 890, 6), (181.0, 910, 6), (191.0, 570, 8), (193.0, 582, 8), (195.0, 194, 14), (195.0, 776, 7), (197.0, 22, 42), (197.0, 88, 21), (197.0, 198, 14), (197.0, 792, 7), (199.0, 44, 30), (199.0, 99, 20), (199.0, 176, 15), (199.0, 275, 12), (199.0, 396, 10), (201.0, 101, 20), (201.0, 404, 10), (215.0, 321, 12), (217.0, 327, 12), (223.0, 777, 8), (224.0, 223, 15), (225.0, 791, 8), (226.0, 227, 15), (233.0, 377, 12), (241.0, 120, 22), (241.0, 480, 11), (242.0, 723, 9), (243.0, 122, 22), (243.0, 488, 11), (244.0, 135, 21), (244.0, 735, 9), (249.0, 155, 20), (249.0, 620, 10), (251.0, 70, 30), (251.0, 280, 15), (251.0, 630, 10), (255.0, 254, 16), (257.0, 258, 16), (271.0, 510, 12), (287.0, 143, 24), (287.0, 572, 12), (288.0, 287, 17), (289.0, 145, 24), (289.0, 580, 12), (290.0, 291, 17), (293.0, 438, 14), (295.0, 111, 28), (295.0, 444, 14), (299.0, 894, 10), (301.0, 906, 10), (305.0, 646, 12), (323.0, 322, 18), (325.0, 326, 18), (337.0, 168, 26), (337.0, 672, 13), (339.0, 170, 26), (339.0, 680, 13), (343.0, 817, 12), (351.0, 77, 40), (351.0, 308, 20), (359.0, 895, 12), (360.0, 359, 19), (361.0, 905, 12), (362.0, 363, 19), (377.0, 987, 12), (383.0, 573, 16), (385.0, 579, 16), (391.0, 195, 28), (391.0, 780, 14), (393.0, 197, 28), (393.0, 788, 14), (399.0, 398, 20), (401.0, 402, 20), (415.0, 299, 24), (424.0, 799, 15), (440.0, 439, 21), (442.0, 443, 21), (449.0, 126, 40), (449.0, 224, 30), (449.0, 350, 24), (449.0, 504, 20), (449.0, 896, 15), (451.0, 226, 30), (451.0, 904, 15), (483.0, 482, 22), (485.0, 54, 66), (485.0, 216, 33), (485.0, 486, 22), (485.0, 726, 18), (487.0, 183, 36), (487.0, 732, 18), (489.0, 305, 28), (511.0, 255, 32), (513.0, 257, 32), (528.0, 527, 23), (530.0, 59, 69), (530.0, 531, 23), (551.0, 759, 20), (575.0, 574, 24), (577.0, 128, 51), (577.0, 288, 34), (577.0, 578, 24), (579.0, 290, 34), (599.0, 897, 20), (601.0, 903, 20), (604.0, 335, 33), (624.0, 623, 25), (626.0, 627, 25), (638.0, 923, 21), (647.0, 323, 36), (649.0, 13, 180), (649.0, 52, 90), (649.0, 117, 60), (649.0, 208, 45), (649.0, 325, 36), (649.0, 468, 30), (675.0, 674, 26), (677.0, 678, 26), (685.0, 266, 42), (687.0, 602, 28), (701.0, 546, 30), (703.0, 858, 24), (721.0, 160, 57), (721.0, 360, 38), (723.0, 362, 38), (727.0, 273, 44), (728.0, 727, 27), (730.0, 731, 27), (737.0, 943, 24), (783.0, 782, 28), (785.0, 786, 28), (799.0, 399, 40), (801.0, 401, 40), (809.0, 505, 36), (840.0, 839, 29), (842.0, 843, 29), (881.0, 440, 42), (881.0, 990, 28), (883.0, 442, 42), (899.0, 898, 30), (901.0, 902, 30), (960.0, 959, 31), (962.0, 107, 93), (962.0, 963, 31), (967.0, 483, 44), (969.0, 485, 44), (1015.0, 381, 52), (1025.0, 114, 96), (1025.0, 456, 48), (1057.0, 528, 46), (1059.0, 530, 46), (1079.0, 165, 84), (1079.0, 660, 42), (1126.0, 115, 105), (1135.0, 994, 36), (1151.0, 92, 120), (1151.0, 207, 80), (1151.0, 368, 60), (1151.0, 575, 48), (1151.0, 828, 40), (1153.0, 577, 48), (1209.0, 755, 44), (1249.0, 624, 50), (1249.0, 975, 40), (1251.0, 626, 50), (1279.0, 710, 48), (1324.0, 159, 105), (1351.0, 108, 130), (1351.0, 300, 78), (1351.0, 432, 65), (1351.0, 507, 60), (1351.0, 675, 52), (1353.0, 677, 52), (1376.0, 935, 45), (1451.0, 174, 110), (1451.0, 696, 55), (1457.0, 728, 54), (1459.0, 730, 54), (1471.0, 690, 56), (1520.0, 31, 273), (1520.0, 279, 91), (1567.0, 348, 84), (1567.0, 783, 56), (1569.0, 785, 56), (1574.0, 91, 165), (1574.0, 819, 55), (1601.0, 178, 120), (1601.0, 712, 60), (1665.0, 221, 112), (1665.0, 884, 56), (1681.0, 840, 58), (1682.0, 187, 123), (1683.0, 842, 58), (1691.0, 470, 78), (1693.0, 658, 66), (1695.0, 371, 88), (1735.0, 651, 68), (1799.0, 899, 60), (1801.0, 901, 60), (1814.0, 555, 77), (1921.0, 960, 62), (1923.0, 962, 62), (1961.0, 545, 84), (2024.0, 175, 153), (2024.0, 567, 85), (2049.0, 41, 320), (2049.0, 164, 160), (2049.0, 656, 80), (2167.0, 813, 76), (2177.0, 153, 176), (2177.0, 612, 88), (2351.0, 282, 140), (2367.0, 518, 104), (2402.0, 267, 147), (2431.0, 285, 144), (2449.0, 544, 105), (2449.0, 850, 84), (2501.0, 278, 150), (2524.0, 303, 145), (2526.0, 707, 95), (2647.0, 993, 84), (2663.0, 407, 132), (2737.0, 608, 111), (3041.0, 855, 104), (3365.0, 374, 174), (3401.0, 357, 180), (3480.0, 71, 413), (3482.0, 43, 531), (3482.0, 387, 177), (3699.0, 74, 430), (3699.0, 296, 215), (3725.0, 874, 126), (3871.0, 860, 132), (3970.0, 539, 171), (3970.0, 891, 133), (4115.0, 714, 154), (4231.0, 940, 138), (4393.0, 793, 156), (4490.0, 499, 201), (4599.0, 437, 220), (4607.0, 188, 336), (4607.0, 423, 224), (4607.0, 752, 168), (4625.0, 514, 204), (4801.0, 294, 280), (4801.0, 384, 245), (4999.0, 204, 350), (4999.0, 816, 175), (5201.0, 234, 340), (5201.0, 416, 255), (5201.0, 936, 170), (5291.0, 270, 322), (5777.0, 642, 228), (5781.0, 590, 238), (5930.0, 659, 231), (6049.0, 525, 264), (6349.0, 762, 230), (6499.0, 130, 570), (6499.0, 520, 285), (6626.0, 795, 235), (6761.0, 345, 364), (7226.0, 803, 255), (7397.0, 822, 258), (7501.0, 186, 550), (7501.0, 744, 275), (7743.0, 158, 616), (7743.0, 632, 308), (7775.0, 69, 936), (7775.0, 276, 468), (7775.0, 621, 312), (7937.0, 558, 336), (8380.0, 551, 357), (8749.0, 378, 450), (8837.0, 982, 282), (9249.0, 185, 680), (9249.0, 740, 340), (9801.0, 29, 1820), (9801.0, 116, 910), (9801.0, 464, 455), (9801.0, 725, 364), (10093.0, 618, 406), (10405.0, 86, 1122), (10405.0, 344, 561), (10405.0, 774, 374), (10610.0, 131, 927), (10951.0, 876, 370), (11551.0, 924, 380), (11663.0, 238, 756), (11663.0, 952, 378), (11775.0, 161, 928), (11775.0, 644, 464), (12151.0, 93, 1260), (12151.0, 372, 630), (12151.0, 837, 420), (12799.0, 316, 720), (13447.0, 332, 738), (13449.0, 269, 820), (13719.0, 665, 532), (14849.0, 957, 480), (15124.0, 375, 781), (15871.0, 465, 736), (16855.0, 129, 1484), (16855.0, 516, 742), (17151.0, 938, 560), (17299.0, 346, 930), (17406.0, 515, 767), (18514.0, 595, 759), (18768.0, 383, 959), (18817.0, 768, 679), (19601.0, 162, 1540), (19601.0, 242, 1260), (19601.0, 450, 924), (19601.0, 648, 770), (19601.0, 800, 693), (19601.0, 882, 660), (19601.0, 968, 630), (19603.0, 58, 2574), (19603.0, 232, 1287), (19603.0, 522, 858), (21295.0, 154, 1716), (21295.0, 616, 858), (22899.0, 458, 1070), (24335.0, 46, 3588), (24335.0, 184, 1794), (24335.0, 414, 1196), (24335.0, 736, 897), (24648.0, 503, 1099), (27379.0, 810, 962), (27849.0, 557, 1180), (28799.0, 476, 1320), (29767.0, 492, 1342), (31212.0, 767, 1127), (33281.0, 585, 1376), (33639.0, 695, 1276), (33857.0, 418, 1656), (34595.0, 706, 1302), (34849.0, 697, 1320), (39689.0, 205, 2772), (39689.0, 820, 1386), (40899.0, 818, 1430), (42283.0, 638, 1674), (42435.0, 866, 1442), (46551.0, 209, 3220), (46551.0, 836, 1610), (48599.0, 297, 2820), (48599.0, 825, 1692), (48842.0, 67, 5967), (48842.0, 603, 1989), (49299.0, 986, 1570), (49730.0, 411, 2453), (51841.0, 245, 3312), (51841.0, 980, 1656), (52021.0, 190, 3774), (52021.0, 760, 1887), (56447.0, 668, 2184), (57499.0, 966, 1850), (57799.0, 76, 6630), (57799.0, 304, 3315), (57799.0, 475, 2652), (57799.0, 684, 2210), (58620.0, 671, 2263), (59535.0, 206, 4148), (59535.0, 824, 2074), (62423.0, 177, 4692), (62423.0, 708, 2346), (62425.0, 351, 3332), (66249.0, 53, 9100), (66249.0, 212, 4550), (66249.0, 848, 2275), (68122.0, 563, 2871), (70226.0, 243, 4505), (70226.0, 867, 2385), (73035.0, 494, 3286), (75263.0, 933, 2464), (75646.0, 715, 2829), (77617.0, 352, 4137), (79201.0, 704, 2985), (80801.0, 909, 2680), (85292.0, 247, 5427), (88751.0, 426, 4300), (88805.0, 246, 5662), (88805.0, 984, 2831), (95831.0, 385, 4884), (97970.0, 339, 5321), (100351.0, 892, 3360), (102151.0, 908, 3390), (106133.0, 942, 3458), (111555.0, 386, 5678), (113399.0, 413, 5580), (114243.0, 338, 6214), (118337.0, 978, 3784), (119071.0, 540, 5124), (120126.0, 875, 4061), (122695.0, 939, 4004), (126003.0, 218, 8534), (126003.0, 872, 4267), (137215.0, 469, 6336), (139128.0, 263, 8579), (143649.0, 425, 6968), (145925.0, 134, 12606), (145925.0, 536, 6303), (146411.0, 830, 5082), (156644.0, 815, 5487), (165337.0, 687, 6308), (165676.0, 591, 6815), (179777.0, 498, 8056), (193549.0, 474, 8890), (194399.0, 213, 13320), (194399.0, 852, 6660), (202501.0, 950, 6570), (213859.0, 370, 11118), (227528.0, 103, 22419), (227528.0, 927, 7473), (228151.0, 237, 14820), (228151.0, 948, 7410), (236926.0, 611, 9585), (237161.0, 705, 8932), (246401.0, 693, 9360), (258065.0, 354, 13716), (275561.0, 945, 8964), (284088.0, 983, 9061), (285769.0, 85, 30996), (285769.0, 340, 15498), (285769.0, 765, 10332), (306917.0, 118, 28254), (306917.0, 472, 14127), (332929.0, 985, 10608), (360449.0, 979, 11520), (392499.0, 314, 22150), (469224.0, 887, 15755), (470449.0, 864, 16005), (499850.0, 459, 23331), (500001.0, 89, 53000), (500001.0, 356, 26500), (515095.0, 201, 36332), (515095.0, 804, 18166), (522785.0, 561, 22072), (561799.0, 236, 36570), (561799.0, 944, 18285), (561835.0, 286, 33222), (605695.0, 609, 24544), (641602.0, 347, 34443), (665857.0, 512, 29427), (669337.0, 543, 28724), (669878.0, 403, 33369), (714024.0, 743, 26195), (842401.0, 832, 29205), (847225.0, 259, 52644), (848719.0, 310, 48204), (900602.0, 827, 31317), (903223.0, 973, 28956), (907925.0, 366, 47458), (930249.0, 125, 83204), (930249.0, 500, 41602), (930249.0, 605, 37820), (954809.0, 355, 50676), (1024001.0, 645, 40320), (1039681.0, 490, 46968), (1039681.0, 640, 41097), (1098305.0, 594, 45064), (1159172.0, 703, 43719), (1197901.0, 682, 45870), (1201887.0, 497, 53912), (1204353.0, 113, 113296), (1204353.0, 452, 56648), (1280001.0, 761, 46400), (1294299.0, 854, 44290), (1524095.0, 429, 73584), (1555849.0, 925, 51156), (1574351.0, 598, 64380), (1618804.0, 535, 69987), (1625626.0, 467, 75225), (1653751.0, 453, 77700), (1850887.0, 428, 89466), (1907162.0, 587, 78717), (2024999.0, 295, 117900), (2143295.0, 94, 221064), (2143295.0, 376, 110532), (2143295.0, 846, 73688), (2271050.0, 699, 85899), (2281249.0, 73, 267000), (2281249.0, 292, 133500), (2281249.0, 657, 89000), (2376415.0, 329, 131016), (2499849.0, 173, 190060), (2499849.0, 692, 95030), (2535751.0, 460, 118230), (2550251.0, 750, 93122), (2588599.0, 133, 224460), (2588599.0, 532, 112230), (2862251.0, 430, 138030), (2989440.0, 479, 136591), (3034565.0, 934, 99294), (3287049.0, 389, 166660), (3505951.0, 636, 139020), (3674890.0, 251, 231957), (3678725.0, 534, 159194), (3844063.0, 217, 260952), (3844063.0, 868, 130476), (3959299.0, 274, 239190), (4120901.0, 918, 136010), (4190210.0, 179, 313191), (4276623.0, 302, 246092), (4293183.0, 542, 184408), (4620799.0, 124, 414960), (4620799.0, 496, 207480), (4620799.0, 775, 165984), (4730624.0, 127, 419775), (4954951.0, 364, 259710), (5286367.0, 713, 197976), (5658247.0, 748, 206886), (5791211.0, 670, 223734), (5848201.0, 229, 386460), (5848201.0, 916, 193230), (6083073.0, 137, 519712), (6083073.0, 548, 259856), (6166395.0, 806, 217202), (6195120.0, 239, 400729), (6998399.0, 717, 261360), (7022501.0, 422, 341850), (7338680.0, 391, 371133), (7352695.0, 741, 270108), (7838695.0, 471, 361188), (8193151.0, 700, 309672), (8193151.0, 847, 281520), (8396801.0, 369, 437120), (8418574.0, 851, 288585), (8429543.0, 583, 349116), (8553815.0, 249, 542076), (8553815.0, 996, 271038), (8835999.0, 995, 280120), (8915765.0, 654, 348634), (8994000.0, 191, 650783), (9314703.0, 878, 314356), (9478657.0, 833, 328416), (9799705.0, 831, 339948), (10394175.0, 734, 383656), (10626551.0, 341, 575460), (11785490.0, 779, 422259), (12320649.0, 293, 719780), (12769001.0, 745, 467820), (12901780.0, 319, 722361), (13588951.0, 969, 436540), (13771351.0, 513, 608020), (14851876.0, 519, 651925), (16883880.0, 311, 957397), (18412804.0, 415, 903849), (19731763.0, 202, 1388322), (19731763.0, 808, 694161), (22619537.0, 722, 841812), (23915529.0, 365, 1251796), (24220799.0, 284, 1437240), (24220799.0, 639, 958160), (24248647.0, 172, 1848942), (24248647.0, 688, 924471), (27365201.0, 666, 1060380), (30580901.0, 550, 1303974), (32080051.0, 106, 3115890), (32080051.0, 424, 1557945), (32080051.0, 954, 1038630), (39480499.0, 250, 2496966), (39480499.0, 1000, 1248483), (42187499.0, 606, 1713750), (43468489.0, 445, 2060604), (46437143.0, 393, 2342444), (46471490.0, 451, 2188257), (51841948.0, 807, 1824923), (51999603.0, 698, 1968214), (52387849.0, 373, 2712540), (59468095.0, 406, 2951352), (62563299.0, 914, 2069410), (62809633.0, 97, 6377352), (62809633.0, 388, 3188676), (62809633.0, 873, 2125784), (64080026.0, 163, 5019135), (67606199.0, 781, 2419140), (73738369.0, 265, 4529712), (74859849.0, 533, 3242540), (77563250.0, 139, 6578829), (85322647.0, 417, 4178268), (88529282.0, 307, 5052633), (95609285.0, 566, 4018758), (102688615.0, 999, 3248924), (104980517.0, 262, 6485718), (107119097.0, 667, 4147668), (107245324.0, 879, 3617295), (110166015.0, 446, 5216512), (120187368.0, 647, 4725053), (123245001.0, 629, 4914100), (129470160.0, 958, 4182991), (130576328.0, 343, 7050459), (138274082.0, 283, 8219541), (142022136.0, 241, 9148450), (142022136.0, 964, 4574225), (143087944.0, 970, 4594277), (146079351.0, 669, 5647754), (150663196.0, 757, 5475947), (151560720.0, 431, 7300423), (151856327.0, 493, 6839265), (155126500.0, 556, 6578829), (158907974.0, 589, 6547689), (162122886.0, 641, 6403469), (164264819.0, 931, 5383562), (167573023.0, 749, 6122985), (169648201.0, 349, 9081060), (170067682.0, 683, 6507459), (174663166.0, 382, 8936545), (189471332.0, 449, 8941705), (192119201.0, 261, 11891880), (192349463.0, 537, 8300492), (195307849.0, 733, 7213860), (197136773.0, 166, 15300781), (200477279.0, 637, 7943199), (218623878.0, 685, 8353189), (220938497.0, 562, 9319728), (224208076.0, 951, 7270445), (225144199.0, 524, 9835470), (241895480.0, 157, 19305361), (250215553.0, 764, 9052481), (252975383.0, 737, 9318468), (255105526.0, 149, 20899059), (262083723.0, 821, 9146785), (263091151.0, 742, 9658380), (268665646.0, 298, 15563383), (270174970.0, 419, 13198911), (271728688.0, 763, 9837239), (275779551.0, 789, 9818012), (275881016.0, 863, 9391099), (277631049.0, 701, 10485980), (278601383.0, 809, 9795103), (283475737.0, 233, 18571113), (291226557.0, 211, 20048863), (291842773.0, 869, 9900088), (292375805.0, 929, 9592539), (293024624.0, 622, 11749217), (293546453.0, 547, 12551140), (295496099.0, 802, 10434330), (299537289.0, 845, 10304396), (300613931.0, 746, 11006258), (303010724.0, 253, 19050121), (306075029.0, 913, 10129605), (306799399.0, 811, 10773184), (312800069.0, 433, 15032212), (317492291.0, 487, 14386949), (320775491.0, 508, 14232111), (325449512.0, 794, 11549771), (334453558.0, 463, 15543375), (335159612.0, 61, 42912791), (335791967.0, 716, 12549135), (336046992.0, 634, 13346131), (339283364.0, 649, 13318037), (348345108.0, 865, 11844089), (355174883.0, 953, 11505243), (361483747.0, 679, 13872473), (363218969.0, 337, 19785798), (363798414.0, 766, 13144571), (366866809.0, 353, 19526350), (368477069.0, 477, 16871406), (372326272.0, 109, 35662389), (372326272.0, 981, 11887463), (373378327.0, 773, 13429485), (378867518.0, 421, 18464873), (380587104.0, 313, 21512055), (384900835.0, 919, 12696707), (385131720.0, 521, 16872927), (386225097.0, 805, 13612646), (387343513.0, 937, 12653961), (387494822.0, 466, 17950351), (388834592.0, 691, 14791965), (391044982.0, 661, 15209887), (391416439.0, 997, 12396283), (391883492.0, 193, 28208391), (393427068.0, 643, 15515249), (394273546.0, 664, 15300781), (395023035.0, 394, 19900973), (395727950.0, 509, 17540333), (396778604.0, 988, 12623209), (401010423.0, 181, 29806870), (401010423.0, 724, 14903435), (402351652.0, 998, 12736219), (407030946.0, 881, 13713221), (413959717.0, 758, 15035694), (419288307.0, 922, 13808525), (423135340.0, 753, 15419909), (423458123.0, 569, 17752288), (425680601.0, 244, 27251408), (425680601.0, 976, 13625704), (426950027.0, 214, 29185703), (431722462.0, 823, 15048899), (434122470.0, 412, 21387679), (437437795.0, 655, 17092109), (440045063.0, 309, 25033289), (440772247.0, 633, 17519124), (442140817.0, 859, 15085650), (446526729.0, 965, 14374204), (455613205.0, 686, 17395393), (464986126.0, 662, 18072199), (473105997.0, 857, 16160993), (474379627.0, 397, 23808431), (483790960.0, 628, 19305361), (486663193.0, 599, 19884519), (494202326.0, 871, 16745407), (497309513.0, 593, 20422054), (498062163.0, 151, 40531724), (498062163.0, 604, 20265862), (500898437.0, 358, 26473305), (503425738.0, 541, 21643963), (506568295.0, 559, 21425556), (510211052.0, 596, 20899059), (516201590.0, 549, 22030947), (517335023.0, 301, 29818695), (519758729.0, 886, 17461636), (527303951.0, 926, 17328283), (529479983.0, 601, 21597939), (532576276.0, 581, 22094987), (534917633.0, 268, 32675295), (536522573.0, 947, 17434641), (541601801.0, 861, 18457740), (544239212.0, 718, 20310827), (545019485.0, 719, 20325797), (546136724.0, 409, 27004723), (547586916.0, 586, 22620607), (548663137.0, 814, 19230633), (548871575.0, 607, 22278010), (549668033.0, 481, 25062705), (549718851.0, 554, 23355316), (551326625.0, 911, 18266266), (553153089.0, 835, 19142652), (560155918.0, 631, 22299455), (562934499.0, 436, 26959673), (563935873.0, 694, 21406713), (564287079.0, 610, 22847316), (566951474.0, 932, 18571113), (567444389.0, 277, 34094429), (568796915.0, 379, 29217135), (570214728.0, 769, 20562469), (572298213.0, 956, 18509447), (576238683.0, 838, 19905835), (577590652.0, 317, 32440723), (579749836.0, 834, 20075095), (582453114.0, 844, 20048863), (583531623.0, 457, 27296458), (584659685.0, 787, 20840867), (587510696.0, 334, 32147155), (588084296.0, 613, 23752501), (589999787.0, 751, 21529398), (591316157.0, 571, 24745811), (598776934.0, 526, 26107915), (599586875.0, 614, 24197357), (605024944.0, 367, 31582045), (606183385.0, 281, 36161869), (606471923.0, 972, 19452596), (609252657.0, 955, 19714953), (615591509.0, 826, 21419168), (619577520.0, 977, 19822041), (619613483.0, 946, 20145372), (620125683.0, 739, 22811692), (622103357.0, 856, 21263055), (622774517.0, 502, 27795787), (628901390.0, 877, 21236491), (635797691.0, 553, 27036868), (640500731.0, 199, 45403893), (644506991.0, 989, 20494130), (650308390.0, 454, 30520485), (650973651.0, 801, 23001023), (659810024.0, 511, 29188277), (667137236.0, 271, 40525701), (673773097.0, 501, 30101962), (675920981.0, 619, 27167558), (676646957.0, 974, 21681167), (689960039.0, 565, 29026837), (696807413.0, 771, 25094906), (698437496.0, 681, 26764183), (699903701.0, 523, 30604652), (707513228.0, 790, 25172191), (707974023.0, 489, 32015692), (712054670.0, 893, 23828001), (713551220.0, 862, 24303651), (716385636.0, 853, 24528577), (725489305.0, 491, 32740874), (731069390.0, 941, 23832181), (739950864.0, 538, 31901547), (766102848.0, 721, 28531161), (768555217.0, 928, 25229061), (770394803.0, 331, 42344728), (775384979.0, 653, 30343159), (775587755.0, 991, 24637357), (783766984.0, 772, 28208391), (801567695.0, 478, 36662853), (823604599.0, 917, 27197820), (836977699.0, 754, 30480930), (879672881.0, 829, 30552302), (888102911.0, 849, 30479613), (941951603.0, 709, 35375735), (958168334.0, 673, 36934675), (959700061.0, 461, 44697688), (991706964.0, 971, 31825391), (994414235.0, 889, 33351583), (1016454459.0, 949, 32995508), (1028830619.0, 907, 34161760), (1032014507.0, 597, 42237542), (1074439109.0, 652, 42078283), (1110550906.0, 517, 48841973), (1114256834.0, 921, 36716011), (1114540897.0, 967, 35841219), (1186224595.0, 883, 39919636), (1196442047.0, 796, 42406764), (1216797167.0, 797, 43101167), (1592796237.0, 617, 64123562), (2178548422.0, 778, 78104745)]
# 	print(max(generateBlindly()))
# print(sorted(generateBlindly(), reverse=True))
# 	print(regularContinuedFractionToFraction(getRepeatingRegContFrac(7)[:-1]))
	ds = [d for d in range(2, 1001) if not sqrt(d).is_integer()]
	candidates = []
	for d in ds:
		i = 1
		regContFrac = getRepeatingRegContFrac(d)
		frac = regularContinuedFractionToFraction(regContFrac[:i])
		x, y = frac.numerator, frac.denominator
		erg = x ** 2 - d * y ** 2
		while erg != 1:
			i += 1
			if i > len(regContFrac): regContFrac = regContFrac + regContFrac[1:]
			frac = regularContinuedFractionToFraction(regContFrac[:i])
			x, y = frac.numerator, frac.denominator
			erg = x ** 2 - d * y ** 2
			
		# (x,d,y)
		print((frac.numerator, d, frac.denominator, erg))
		candidates.append((frac.numerator, d, frac.denominator))
		
	print(max(candidates))