Knowledge

Cornacchia's algorithm

Source 📝

1490: 491: 892: 788: 397: 187: 334: 1494: 434: 1002: 703: 965: 78: 736: 110: 536: 1035: 218: 1359: 995: 917: 1227: 1550: 1169: 988: 1098: 1275: 1073: 1184: 1222: 1159: 1103: 1066: 1364: 1255: 1174: 1164: 1040: 1192: 1445: 1440: 1369: 1270: 439: 1407: 817: 1321: 741: 339: 17: 1486: 1476: 1435: 1211: 1205: 1179: 1050: 220:
exist, there can be no primitive solution to the original equation. Without loss of generality, we can assume that
135: 283: 1412: 545:
until either a solution is found or all roots have been exhausted. In this case there is no primitive solution.
1374: 1247: 1093: 1045: 594:, then all solutions are primitive). Thus the above algorithm can be used to search for a primitive solution 1389: 1280: 1500: 1450: 1430: 402: 1151: 1126: 1055: 1510: 705:. A square root of −6 (mod 103) is 32, and 103 â‰Ą 7 (mod 32); since 659: 1505: 1397: 1379: 1354: 1316: 1060: 29: 921: 34: 1515: 1481: 1402: 1306: 1265: 1260: 1237: 1141: 591: 277: 708: 83: 1346: 1293: 1290: 1131: 1030: 496: 190: 1087: 1080: 1466: 1422: 1136: 1113: 1311: 814:
Cornacchia, G. (1908). "Su di un metodo per la risoluzione in numeri interi dell' equazione
196: 1301: 1200: 1331: 1232: 1217: 1121: 1022: 1544: 1326: 1011: 1336: 980: 1014: 25: 121: 984: 124:. The algorithm was described in 1908 by Giuseppe Cornacchia. 576:, note that the existence of such a solution implies that 1531:
indicate that algorithm is for numbers of special forms
747: 451: 924: 820: 744: 711: 662: 499: 442: 405: 342: 286: 199: 138: 86: 37: 1459: 1421: 1388: 1345: 1289: 1246: 1150: 1112: 1021: 486:{\displaystyle s={\sqrt {\tfrac {m-r_{k}^{2}}{d}}}} 959: 887:{\displaystyle \sum _{h=0}^{n}C_{h}x^{n-h}y^{h}=P} 886: 782: 730: 697: 530: 485: 428: 391: 328: 212: 181: 104: 72: 783:{\displaystyle {\sqrt {\tfrac {103-7^{2}}{6}}}=3} 392:{\displaystyle r_{2}\equiv r_{0}{\pmod {r_{1}}}} 996: 648:will be a solution to the original equation. 182:{\displaystyle r_{0}^{2}\equiv -d{\pmod {m}}} 8: 329:{\displaystyle r_{1}\equiv m{\pmod {r_{0}}}} 1003: 989: 981: 945: 929: 923: 872: 856: 846: 836: 825: 819: 760: 745: 743: 716: 710: 683: 667: 661: 510: 498: 469: 464: 449: 441: 419: 410: 404: 379: 366: 360: 347: 341: 316: 303: 291: 285: 204: 198: 163: 148: 143: 137: 85: 58: 42: 36: 806: 189:(perhaps by using an algorithm listed 896:Giornale di Matematiche di Battaglini 636:. If such a solution is found, then 7: 493:is an integer, then the solution is 429:{\displaystyle r_{k}<{\sqrt {m}}} 374: 311: 171: 14: 1212:Special number field sieve (SNFS) 1206:General number field sieve (GNFS) 698:{\displaystyle x^{2}+6y^{2}=103} 548:To find non-primitive solutions 538:; otherwise try another root of 269:, which will still be a root of 367: 304: 164: 960:{\displaystyle x^{2}+dy^{2}=m} 385: 368: 322: 305: 175: 165: 73:{\displaystyle x^{2}+dy^{2}=m} 1: 1170:Lenstra elliptic curve (ECM) 731:{\displaystyle 7^{2}<103} 132:First, find any solution to 105:{\displaystyle 1\leq d<m} 1551:Number theoretic algorithms 586:(and equivalently, that if 531:{\displaystyle x=r_{k},y=s} 18:computational number theory 1567: 1477:Exponentiation by squaring 1160:Continued fraction (CFRAC) 1524: 1390:Greatest common divisor 916:Basilla, J. M. (2004). 1501:Modular exponentiation 961: 888: 841: 790:, there is a solution 784: 732: 699: 532: 487: 430: 393: 330: 247:(if not, then replace 214: 183: 106: 74: 22:Cornacchia's algorithm 1228:Shanks's square forms 1152:Integer factorization 1127:Sieve of Eratosthenes 962: 918:"On the solutions of 889: 821: 794: = 7,  785: 733: 700: 533: 488: 431: 399:and so on; stop when 394: 331: 215: 213:{\displaystyle r_{0}} 184: 107: 75: 1506:Montgomery reduction 1380:Function field sieve 1355:Baby-step giant-step 1201:Quadratic sieve (QS) 922: 818: 742: 709: 660: 497: 440: 403: 340: 284: 197: 136: 84: 35: 30:Diophantine equation 1516:Trachtenberg system 1482:Integer square root 1423:Modular square root 1142:Wheel factorization 1094:Quadratic Frobenius 1074:Lucas–Lehmer–Riesel 656:Solve the equation 474: 278:Euclidean algorithm 153: 1408:Extended Euclidean 1347:Discrete logarithm 1276:Schönhage–Strassen 1132:Sieve of Pritchard 957: 884: 780: 771: 728: 695: 528: 483: 480: 460: 426: 389: 326: 210: 179: 139: 102: 70: 1538: 1537: 1137:Sieve of Sundaram 772: 770: 481: 479: 424: 276:). Then use the 1558: 1487:Integer relation 1460:Other algorithms 1365:Pollard kangaroo 1256:Ancient Egyptian 1114:Prime-generating 1099:Solovay–Strassen 1012:Number-theoretic 1005: 998: 991: 982: 977: 974:Proc. Japan Acad 971: 966: 964: 963: 958: 950: 949: 934: 933: 904: 903: 893: 891: 890: 885: 877: 876: 867: 866: 851: 850: 840: 835: 811: 798: = 3. 789: 787: 786: 781: 773: 766: 765: 764: 748: 746: 737: 735: 734: 729: 721: 720: 704: 702: 701: 696: 688: 687: 672: 671: 647: 635: 634: 632: 631: 626: 623: 605: 589: 585: 581: 575: 559: 544: 537: 535: 534: 529: 515: 514: 492: 490: 489: 484: 482: 475: 473: 468: 452: 450: 435: 433: 432: 427: 425: 420: 415: 414: 398: 396: 395: 390: 388: 384: 383: 365: 364: 352: 351: 335: 333: 332: 327: 325: 321: 320: 296: 295: 275: 268: 255: 246: 245: 243: 242: 239: 236: 219: 217: 216: 211: 209: 208: 188: 186: 185: 180: 178: 152: 147: 111: 109: 108: 103: 79: 77: 76: 71: 63: 62: 47: 46: 28:for solving the 1566: 1565: 1561: 1560: 1559: 1557: 1556: 1555: 1541: 1540: 1539: 1534: 1520: 1455: 1417: 1384: 1341: 1285: 1242: 1146: 1108: 1081:Proth's theorem 1023:Primality tests 1017: 1009: 976:. 80(A): 40–41. 969: 941: 925: 920: 919: 915: 912: 907: 868: 852: 842: 816: 815: 813: 812: 808: 804: 756: 749: 740: 739: 712: 707: 706: 679: 663: 658: 657: 654: 637: 627: 624: 619: 618: 616: 607: 595: 587: 583: 577: 561: 549: 539: 506: 495: 494: 453: 438: 437: 406: 401: 400: 375: 356: 343: 338: 337: 312: 287: 282: 281: 270: 267: 257: 254: 248: 240: 237: 232: 231: 229: 227: 221: 200: 195: 194: 134: 133: 130: 82: 81: 54: 38: 33: 32: 12: 11: 5: 1564: 1562: 1554: 1553: 1543: 1542: 1536: 1535: 1533: 1532: 1525: 1522: 1521: 1519: 1518: 1513: 1508: 1503: 1498: 1484: 1479: 1474: 1469: 1463: 1461: 1457: 1456: 1454: 1453: 1448: 1443: 1441:Tonelli–Shanks 1438: 1433: 1427: 1425: 1419: 1418: 1416: 1415: 1410: 1405: 1400: 1394: 1392: 1386: 1385: 1383: 1382: 1377: 1375:Index calculus 1372: 1370:Pohlig–Hellman 1367: 1362: 1357: 1351: 1349: 1343: 1342: 1340: 1339: 1334: 1329: 1324: 1322:Newton-Raphson 1319: 1314: 1309: 1304: 1298: 1296: 1287: 1286: 1284: 1283: 1278: 1273: 1268: 1263: 1258: 1252: 1250: 1248:Multiplication 1244: 1243: 1241: 1240: 1235: 1233:Trial division 1230: 1225: 1220: 1218:Rational sieve 1215: 1208: 1203: 1198: 1190: 1182: 1177: 1172: 1167: 1162: 1156: 1154: 1148: 1147: 1145: 1144: 1139: 1134: 1129: 1124: 1122:Sieve of Atkin 1118: 1116: 1110: 1109: 1107: 1106: 1101: 1096: 1091: 1084: 1077: 1070: 1063: 1058: 1053: 1048: 1046:Elliptic curve 1043: 1038: 1033: 1027: 1025: 1019: 1018: 1010: 1008: 1007: 1000: 993: 985: 979: 978: 956: 953: 948: 944: 940: 937: 932: 928: 911: 910:External links 908: 906: 905: 883: 880: 875: 871: 865: 862: 859: 855: 849: 845: 839: 834: 831: 828: 824: 805: 803: 800: 779: 776: 769: 763: 759: 755: 752: 727: 724: 719: 715: 694: 691: 686: 682: 678: 675: 670: 666: 653: 650: 527: 524: 521: 518: 513: 509: 505: 502: 478: 472: 467: 463: 459: 456: 448: 445: 423: 418: 413: 409: 387: 382: 378: 373: 370: 363: 359: 355: 350: 346: 324: 319: 315: 310: 307: 302: 299: 294: 290: 265: 252: 225: 207: 203: 193:); if no such 177: 174: 170: 167: 162: 159: 156: 151: 146: 142: 129: 126: 101: 98: 95: 92: 89: 69: 66: 61: 57: 53: 50: 45: 41: 13: 10: 9: 6: 4: 3: 2: 1563: 1552: 1549: 1548: 1546: 1530: 1527: 1526: 1523: 1517: 1514: 1512: 1509: 1507: 1504: 1502: 1499: 1496: 1492: 1488: 1485: 1483: 1480: 1478: 1475: 1473: 1470: 1468: 1465: 1464: 1462: 1458: 1452: 1449: 1447: 1444: 1442: 1439: 1437: 1436:Pocklington's 1434: 1432: 1429: 1428: 1426: 1424: 1420: 1414: 1411: 1409: 1406: 1404: 1401: 1399: 1396: 1395: 1393: 1391: 1387: 1381: 1378: 1376: 1373: 1371: 1368: 1366: 1363: 1361: 1358: 1356: 1353: 1352: 1350: 1348: 1344: 1338: 1335: 1333: 1330: 1328: 1325: 1323: 1320: 1318: 1315: 1313: 1310: 1308: 1305: 1303: 1300: 1299: 1297: 1295: 1292: 1288: 1282: 1279: 1277: 1274: 1272: 1269: 1267: 1264: 1262: 1259: 1257: 1254: 1253: 1251: 1249: 1245: 1239: 1236: 1234: 1231: 1229: 1226: 1224: 1221: 1219: 1216: 1214: 1213: 1209: 1207: 1204: 1202: 1199: 1197: 1195: 1191: 1189: 1187: 1183: 1181: 1180:Pollard's rho 1178: 1176: 1173: 1171: 1168: 1166: 1163: 1161: 1158: 1157: 1155: 1153: 1149: 1143: 1140: 1138: 1135: 1133: 1130: 1128: 1125: 1123: 1120: 1119: 1117: 1115: 1111: 1105: 1102: 1100: 1097: 1095: 1092: 1090: 1089: 1085: 1083: 1082: 1078: 1076: 1075: 1071: 1069: 1068: 1064: 1062: 1059: 1057: 1054: 1052: 1049: 1047: 1044: 1042: 1039: 1037: 1034: 1032: 1029: 1028: 1026: 1024: 1020: 1016: 1013: 1006: 1001: 999: 994: 992: 987: 986: 983: 975: 968: 954: 951: 946: 942: 938: 935: 930: 926: 914: 913: 909: 901: 897: 881: 878: 873: 869: 863: 860: 857: 853: 847: 843: 837: 832: 829: 826: 822: 810: 807: 801: 799: 797: 793: 777: 774: 767: 761: 757: 753: 750: 725: 722: 717: 713: 692: 689: 684: 680: 676: 673: 668: 664: 651: 649: 645: 641: 630: 622: 614: 610: 603: 599: 593: 580: 573: 569: 565: 557: 553: 546: 543: 525: 522: 519: 516: 511: 507: 503: 500: 476: 470: 465: 461: 457: 454: 446: 443: 421: 416: 411: 407: 380: 376: 371: 361: 357: 353: 348: 344: 317: 313: 308: 300: 297: 292: 288: 279: 274: 264: 260: 251: 235: 224: 205: 201: 192: 172: 168: 160: 157: 154: 149: 144: 140: 128:The algorithm 127: 125: 123: 119: 115: 99: 96: 93: 90: 87: 67: 64: 59: 55: 51: 48: 43: 39: 31: 27: 23: 19: 1528: 1471: 1210: 1193: 1185: 1104:Miller–Rabin 1086: 1079: 1072: 1067:Lucas–Lehmer 1065: 973: 899: 895: 809: 795: 791: 655: 643: 639: 628: 620: 612: 608: 601: 597: 578: 571: 567: 563: 555: 551: 547: 541: 272: 262: 258: 249: 233: 222: 131: 117: 113: 21: 15: 1360:Pollard rho 1317:Goldschmidt 1051:Pocklington 1041:Baillie–PSW 592:square-free 1472:Cornacchia 1467:Chakravala 1015:algorithms 802:References 1446:Berlekamp 1403:Euclidean 1291:Euclidean 1271:Toom–Cook 1266:Karatsuba 861:− 823:∑ 754:− 458:− 354:≡ 298:≡ 158:− 155:≡ 91:≤ 26:algorithm 1545:Category 1413:Lehmer's 1307:Chunking 1294:division 1223:Fermat's 902:: 33–90. 582:divides 280:to find 80:, where 1529:Italics 1451:Kunerth 1431:Cipolla 1312:Fourier 1281:FĂŒrer's 1175:Euler's 1165:Dixon's 1088:PĂ©pin's 652:Example 633:⁠ 617:⁠ 244:⁠ 230:⁠ 122:coprime 1511:Schoof 1398:Binary 1302:Binary 1238:Shor's 1056:Fermat 560:where 24:is an 1332:Short 1061:Lucas 970:(PDF) 436:. If 256:with 1327:Long 1261:Long 738:and 723:< 570:) = 562:gcd( 417:< 191:here 120:are 116:and 112:and 97:< 1491:LLL 1337:SRT 1196:+ 1 1188:− 1 1036:APR 1031:AKS 894:". 751:103 726:103 693:103 606:to 590:is 574:≠ 1 372:mod 309:mod 169:mod 16:In 1547:: 1495:KZ 1493:; 972:. 900:46 898:. 644:gv 642:, 640:gu 615:= 613:dv 611:+ 600:, 566:, 554:, 336:, 261:- 228:≀ 20:, 1497:) 1489:( 1194:p 1186:p 1004:e 997:t 990:v 967:" 955:m 952:= 947:2 943:y 939:d 936:+ 931:2 927:x 882:P 879:= 874:h 870:y 864:h 858:n 854:x 848:h 844:C 838:n 833:0 830:= 827:h 796:y 792:x 778:3 775:= 768:6 762:2 758:7 718:2 714:7 690:= 685:2 681:y 677:6 674:+ 669:2 665:x 646:) 638:( 629:g 625:/ 621:m 609:u 604:) 602:v 598:u 596:( 588:m 584:m 579:g 572:g 568:y 564:x 558:) 556:y 552:x 550:( 542:d 540:- 526:s 523:= 520:y 517:, 512:k 508:r 504:= 501:x 477:d 471:2 466:k 462:r 455:m 447:= 444:s 422:m 412:k 408:r 386:) 381:1 377:r 369:( 362:0 358:r 349:2 345:r 323:) 318:0 314:r 306:( 301:m 293:1 289:r 273:d 271:- 266:0 263:r 259:m 253:0 250:r 241:2 238:/ 234:m 226:0 223:r 206:0 202:r 176:) 173:m 166:( 161:d 150:2 145:0 141:r 118:m 114:d 100:m 94:d 88:1 68:m 65:= 60:2 56:y 52:d 49:+ 44:2 40:x

Index

computational number theory
algorithm
Diophantine equation
coprime
here
Euclidean algorithm
square-free
"On the solutions of x 2 + d y 2 = m {\displaystyle x^{2}+dy^{2}=m} "
v
t
e
Number-theoretic
algorithms
Primality tests
AKS
APR
Baillie–PSW
Elliptic curve
Pocklington
Fermat
Lucas
Lucas–Lehmer
Lucas–Lehmer–Riesel
Proth's theorem
PĂ©pin's
Quadratic Frobenius
Solovay–Strassen
Miller–Rabin
Prime-generating
Sieve of Atkin

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑