Knowledge

Fermat's factorization method

Source 📝

33: 1127: 386: 3408: 1653: 414:
In its simplest form, Fermat's method might be even slower than trial division (worst case). Nonetheless, the combination of trial division and Fermat's is more effective than either by itself.
1523: 3412: 1735: 1694: 1247: 588: 2920: 2660:, which are the "worst-case". The primary improvement that quadratic sieve makes over Fermat's factorization method is that instead of simply finding a square in the sequence of 1582: 2405: 197: 470: 2543: 2499: 2092: 1832: 1547: 1472: 1328: 1271: 874: 2638: 910: 251: 50: 996: 2953: 2691: 2001: 1956: 781: 749: 524: 2220: 2148: 2059: 2028: 1859: 1189: 946: 713: 687: 287: 2590: 2361: 2330: 1160: 818: 2455: 2432: 1001: 299: 1477:
Trial division would normally try up to 48,432; but after only four Fermat steps, we need only divide up to 47830, to find a factor or prove primality.
3468: 3277: 2913: 2769: 3145: 97: 69: 3087: 2906: 1587: 3016: 3193: 2795: 76: 2991: 116: 2003:
produces 3, 4, 7, 8, 12, and 19 modulo 20 for these values. It is apparent that only the 4 from this list can be a square. Thus,
3102: 3077: 83: 3021: 2984: 3282: 3173: 3092: 3082: 2754: 2958: 3110: 54: 3363: 65: 3358: 3287: 3188: 3325: 2719: 2278: 3239: 1483: 2774: 2886: 2697:
is a square, and it does this in a highly efficient manner. The end result is the same: a difference of squares mod
3404: 3394: 3353: 3129: 3123: 3097: 2968: 2803: 2653: 3389: 3330: 786:
Suppose N has more than two prime factors. That procedure first finds the factorization with the least values of
144: 3292: 3165: 3011: 2963: 1699: 1658: 1202: 90: 3307: 3198: 43: 541: 3418: 3368: 3348: 2892: 2267:
b2 is a square, modulo modulus: FermatSieve(N, a, aend, astep * modulus, NextModulus)
3069: 3044: 2973: 2759: 2714: 1552: 3428: 2854: 2596:. R. Lehman devised a systematic way to do this, so that Fermat's plus trial division can factor N in 3423: 3315: 3297: 3272: 3234: 2978: 2739: 2734: 403:
are also odd, so those halves are integers. (A multiple of four is also a difference of squares: let
137: 2366: 1740:
In this regard, Fermat's method gives diminishing returns. One would surely stop before this point:
153: 3433: 3399: 3320: 3224: 3183: 3178: 3155: 3059: 429: 2504: 2460: 2071: 1811: 487:
a square: a ← a + 1 b2 ← a*a - N // equivalently: // b2 ← b2 + 2*a + 1
3264: 3211: 3208: 3049: 2948: 2822: 1963: 1528: 1445: 1309: 1252: 827: 3005: 2998: 2599: 883: 209: 955: 3384: 3340: 3054: 3031: 2764: 2663: 1973: 1928: 754: 3229: 2866: 2812: 722: 503: 133: 2198: 2126: 2037: 2006: 1837: 3219: 3118: 2649: 2333: 1165: 1122:{\displaystyle (c+d)/2-{\sqrt {N}}=({\sqrt {d}}-{\sqrt {c}})^{2}/2=({\sqrt {N}}-c)^{2}/2c} 922: 692: 666: 263: 2567: 2338: 2307: 1139: 797: 2437: 2414: 3249: 3150: 3135: 3039: 2940: 2724: 3462: 3244: 2929: 2749: 381:{\displaystyle N=\left({\frac {c+d}{2}}\right)^{2}-\left({\frac {c-d}{2}}\right)^{2}} 1195:
has a factor close to its square root, the method works quickly. More precisely, if
3254: 2744: 2871: 1970:
by 10. In this example, N is 17 mod 20, so subtracting 17 mod 20 (or adding 3),
32: 2898: 2657: 590:. Since 125 is not a square, a second try is made by increasing the value of 17: 2932: 2729: 2648:
The fundamental ideas of Fermat's factorization method are the basis of the
2297:
Fermat's method works best when there is a factor near the square-root of
2285:-values remain; that is, when (aend-astart)/astep is small. Also, because 2289:
s step-size is constant, one can compute successive b2's with additions.
594:
by 1. The second attempt also fails, because 282 is again not a square.
1273:, the method requires only one step; this is independent of the size of 2826: 203: 140: 2245:
One generally chooses a power of a different prime for each modulus.
1696:
the bound for trial division is 47830. A reasonable choice could be
1648:{\displaystyle a_{\mathrm {max} }-{\sqrt {a_{\mathrm {max} }^{2}-N}}} 2817: 2252:-values (start, end, and step) and a modulus, one can proceed thus: 1330:
rounded up to the next integer, which is 48,433, we can tabulate:
1480:
This all suggests a combined factoring method. Choose some bound
2255:
FermatSieve(N, astart, aend, astep, modulus) a ← astart
253:; if neither factor equals one, it is a proper factorization of 2902: 26: 1434:
In practice, one wouldn't bother with that last row until
663:
The third try produces the perfect square of 441. Thus,
3449:
indicate that algorithm is for numbers of special forms
2693:, it finds a subset of elements of this sequence whose 2068:
This can be performed with any modulus. Using the same
1925:
It is not necessary to compute all the square-roots of
2592:
values can be tried, and try to factor each resulting
260:
Each odd number has such a representation. Indeed, if
2666: 2602: 2570: 2507: 2463: 2440: 2417: 2369: 2341: 2310: 2201: 2129: 2074: 2040: 2009: 1976: 1931: 1840: 1814: 1702: 1661: 1590: 1555: 1531: 1486: 1448: 1312: 1255: 1205: 1168: 1142: 1004: 958: 925: 886: 830: 800: 757: 725: 695: 669: 544: 506: 432: 302: 266: 212: 156: 1962:. Squares are always congruent to 0, 1, 4, 5, 9, 16 1191:
steps. This is a bad way to prove primality. But if
3377: 3339: 3306: 3263: 3207: 3164: 3068: 3030: 2939: 57:. Unsourced material may be challenged and removed. 2685: 2632: 2584: 2537: 2493: 2449: 2426: 2399: 2355: 2324: 2214: 2142: 2086: 2053: 2022: 1995: 1950: 1853: 1834:, one can quickly tell that none of the values of 1826: 1729: 1688: 1647: 1584:. This gives a bound for trial division which is 1576: 1541: 1517: 1466: 1322: 1265: 1241: 1183: 1154: 1121: 990: 940: 904: 868: 812: 775: 743: 707: 681: 582: 518: 464: 380: 281: 245: 191: 1518:{\displaystyle a_{\mathrm {max} }>{\sqrt {N}}} 2656:, the best-known algorithms for factoring large 2508: 2464: 1474:, Fermat's method would have found it already. 2564:Generally, if the ratio is not known, various 2914: 8: 2034:is 1, 9, 11 or 19 mod 20; it will produce a 1966:20. The values repeat with each increase of 820:is the smallest factor ≄ the square-root of 2701:that, if nontrivial, can be used to factor 1285:Consider trying to factor the prime number 2921: 2907: 2899: 1525:; use Fermat's method for factors between 998:, so the number of steps is approximately 479:a ← ceiling(sqrt(N)) b2 ← a*a - N 2870: 2816: 2671: 2665: 2617: 2613: 2601: 2574: 2569: 2506: 2462: 2439: 2416: 2368: 2345: 2340: 2314: 2309: 2304:If the approximate ratio of two factors ( 2206: 2200: 2134: 2128: 2073: 2045: 2039: 2014: 2008: 1981: 1975: 1936: 1930: 1845: 1839: 1813: 1708: 1707: 1701: 1667: 1666: 1660: 1631: 1619: 1618: 1612: 1596: 1595: 1589: 1561: 1560: 1554: 1532: 1530: 1508: 1492: 1491: 1485: 1447: 1313: 1311: 1256: 1254: 1229: 1225: 1207: 1204: 1167: 1141: 1108: 1102: 1085: 1071: 1065: 1054: 1044: 1031: 1020: 1003: 980: 957: 924: 885: 846: 829: 799: 756: 724: 694: 668: 562: 549: 543: 534:rounded up to the next integer, which is 505: 456: 437: 431: 372: 350: 336: 314: 301: 265: 211: 180: 167: 155: 117:Learn how and when to remove this message 2893:Fermat's Factorization Online Calculator 2770:Table of Gaussian integer factorizations 2061:which ends in 4 mod 20 and, if square, 1863: 1742: 1730:{\displaystyle a_{\mathrm {max} }=55000} 1689:{\displaystyle a_{\mathrm {max} }=48436} 1332: 596: 2786: 1242:{\displaystyle {\left(4N\right)}^{1/4}} 136:, is based on the representation of an 1958:, nor even examine all the values for 583:{\displaystyle b^{2}=78^{2}-5959=125} 7: 2855:"Speeding Fermat's factoring method" 55:adding citations to reliable sources 2887:Fermat's factorization running time 2030:must be 1 mod 20, which means that 1438:is an integer. But observe that if 2407:, and Fermat's method, applied to 1715: 1712: 1709: 1674: 1671: 1668: 1626: 1623: 1620: 1603: 1600: 1597: 1577:{\displaystyle a_{\mathrm {max} }} 1568: 1565: 1562: 1499: 1496: 1493: 1280: 25: 3130:Special number field sieve (SNFS) 3124:General number field sieve (GNFS) 3469:Integer factorization algorithms 31: 2363:can be picked near that value. 2263:: b2 ← a*a - N 1808:When considering the table for 952:be the largest subroot factor. 66:"Fermat's factorization method" 42:needs additional citations for 2627: 2606: 2526: 2511: 2482: 2467: 2400:{\displaystyle Nuv=cv\cdot du} 1655:. In the above example, with 1178: 1172: 1099: 1082: 1062: 1041: 1017: 1005: 977: 965: 863: 851: 240: 228: 225: 213: 192:{\displaystyle N=a^{2}-b^{2}.} 1: 2872:10.1090/S0025-5718-99-01133-3 2167:3 or 5 or 11 or 13 modulo 16 876:is the largest factor ≀ root- 465:{\displaystyle a^{2}-N=b^{2}} 130:Fermat's factorization method 3088:Lenstra elliptic curve (ECM) 2755:Euler's factorization method 2720:Factorization of polynomials 2538:{\displaystyle \gcd(N,du)=d} 2494:{\displaystyle \gcd(N,cv)=c} 2087:{\displaystyle N=2345678917} 1827:{\displaystyle N=2345678917} 422:One tries various values of 2794:Lehman, R. Sherman (1974). 2065:will end in 2 or 8 mod 10. 1542:{\displaystyle {\sqrt {N}}} 1467:{\displaystyle a-b=47830.1} 1442:had a subroot factor above 1323:{\displaystyle {\sqrt {N}}} 1306:throughout. Going up from 1281:Fermat's and trial division 1266:{\displaystyle {\sqrt {N}}} 869:{\displaystyle a-b=N/(a+b)} 3485: 3395:Exponentiation by squaring 3078:Continued fraction (CFRAC) 2859:Mathematics of Computation 2848:, vol. 2, p. 256 2804:Mathematics of Computation 2796:"Factoring Large Integers" 2654:general number field sieve 2633:{\displaystyle O(N^{1/3})} 905:{\displaystyle N=1\cdot N} 246:{\displaystyle (a+b)(a-b)} 3442: 1737:giving a bound of 28937. 991:{\displaystyle a=(c+d)/2} 880:. If the procedure finds 145:difference of two squares 2411:, will find the factors 3308:Greatest common divisor 2686:{\displaystyle a^{2}-n} 1996:{\displaystyle a^{2}-N} 1951:{\displaystyle a^{2}-N} 776:{\displaystyle a+b=101} 500:For example, to factor 3419:Modular exponentiation 2687: 2634: 2586: 2539: 2495: 2451: 2428: 2401: 2357: 2326: 2293:Multiplier improvement 2216: 2144: 2088: 2055: 2024: 1997: 1952: 1855: 1828: 1731: 1690: 1649: 1578: 1543: 1519: 1468: 1324: 1267: 1243: 1185: 1156: 1123: 992: 942: 906: 870: 814: 777: 745: 744:{\displaystyle a-b=59} 709: 683: 584: 530:is the square root of 520: 519:{\displaystyle N=5959} 466: 382: 289:is a factorization of 283: 247: 193: 3146:Shanks's square forms 3070:Integer factorization 3045:Sieve of Eratosthenes 2760:Integer factorization 2715:Completing the square 2688: 2635: 2587: 2540: 2496: 2452: 2429: 2402: 2358: 2327: 2217: 2215:{\displaystyle a^{2}} 2145: 2143:{\displaystyle a^{2}} 2089: 2056: 2054:{\displaystyle b^{2}} 2025: 2023:{\displaystyle a^{2}} 1998: 1953: 1856: 1854:{\displaystyle b^{2}} 1829: 1732: 1691: 1650: 1579: 1544: 1520: 1469: 1325: 1268: 1244: 1186: 1157: 1124: 993: 943: 907: 871: 815: 778: 746: 715:, and the factors of 710: 684: 585: 521: 467: 383: 284: 248: 194: 3424:Montgomery reduction 3298:Function field sieve 3273:Baby-step giant-step 3119:Quadratic sieve (QS) 2775:Unique factorization 2735:Monoid factorisation 2664: 2600: 2568: 2505: 2461: 2438: 2415: 2367: 2339: 2308: 2281:is stopped when few 2248:Given a sequence of 2199: 2127: 2072: 2038: 2007: 1974: 1929: 1838: 1812: 1700: 1659: 1588: 1553: 1529: 1484: 1446: 1310: 1253: 1203: 1184:{\displaystyle O(N)} 1166: 1140: 1002: 956: 941:{\displaystyle N=cd} 923: 884: 828: 798: 755: 723: 708:{\displaystyle b=21} 693: 682:{\displaystyle a=80} 667: 542: 526:, the first try for 504: 430: 300: 282:{\displaystyle N=cd} 264: 210: 154: 51:improve this article 3434:Trachtenberg system 3400:Integer square root 3341:Modular square root 3060:Wheel factorization 3012:Quadratic Frobenius 2992:Lucas–Lehmer–Riesel 2895:, at windowspros.ru 2585:{\displaystyle u/v} 2356:{\displaystyle v/u} 2332:) is known, then a 2325:{\displaystyle d/c} 1636: 1292:, but also compute 1155:{\displaystyle c=1} 813:{\displaystyle a+b} 202:That difference is 3326:Extended Euclidean 3265:Discrete logarithm 3194:Schönhage–Strassen 3050:Sieve of Pritchard 2865:(228): 1729–1737. 2683: 2644:Other improvements 2630: 2582: 2535: 2491: 2450:{\displaystyle du} 2447: 2427:{\displaystyle cv} 2424: 2397: 2353: 2322: 2271:a ← a + astep 2212: 2140: 2084: 2051: 2020: 1993: 1948: 1851: 1824: 1727: 1686: 1645: 1614: 1574: 1539: 1515: 1464: 1320: 1263: 1239: 1199:differs less than 1181: 1152: 1136:is prime (so that 1119: 988: 938: 912:, that shows that 902: 866: 810: 773: 741: 705: 679: 580: 516: 496:// or a + sqrt(b2) 477:// N should be odd 462: 378: 279: 243: 189: 3456: 3455: 3055:Sieve of Sundaram 2853:McKee, J (1999). 2846:Oeuvres de Fermat 2765:Program synthesis 2740:Pascal's triangle 2243: 2242: 1923: 1922: 1804:Sieve improvement 1801: 1800: 1643: 1537: 1513: 1432: 1431: 1318: 1261: 1090: 1059: 1049: 1036: 661: 660: 490:// a ← a + 1 475:FermatFactor(N): 366: 330: 127: 126: 119: 101: 16:(Redirected from 3476: 3405:Integer relation 3378:Other algorithms 3283:Pollard kangaroo 3174:Ancient Egyptian 3032:Prime-generating 3017:Solovay–Strassen 2930:Number-theoretic 2923: 2916: 2909: 2900: 2889:, at blogspot.in 2876: 2874: 2849: 2831: 2830: 2820: 2811:(126): 637–646. 2800: 2791: 2692: 2690: 2689: 2684: 2676: 2675: 2639: 2637: 2636: 2631: 2626: 2625: 2621: 2591: 2589: 2588: 2583: 2578: 2544: 2542: 2541: 2536: 2500: 2498: 2497: 2492: 2456: 2454: 2453: 2448: 2433: 2431: 2430: 2425: 2406: 2404: 2403: 2398: 2362: 2360: 2359: 2354: 2349: 2331: 2329: 2328: 2323: 2318: 2239:4 or 5 modulo 9 2235: 2221: 2219: 2218: 2213: 2211: 2210: 2163: 2149: 2147: 2146: 2141: 2139: 2138: 2097: 2096: 2093: 2091: 2090: 2085: 2064: 2060: 2058: 2057: 2052: 2050: 2049: 2033: 2029: 2027: 2026: 2021: 2019: 2018: 2002: 2000: 1999: 1994: 1986: 1985: 1969: 1961: 1957: 1955: 1954: 1949: 1941: 1940: 1864: 1860: 1858: 1857: 1852: 1850: 1849: 1833: 1831: 1830: 1825: 1743: 1736: 1734: 1733: 1728: 1720: 1719: 1718: 1695: 1693: 1692: 1687: 1679: 1678: 1677: 1654: 1652: 1651: 1646: 1644: 1635: 1630: 1629: 1613: 1608: 1607: 1606: 1583: 1581: 1580: 1575: 1573: 1572: 1571: 1548: 1546: 1545: 1540: 1538: 1533: 1524: 1522: 1521: 1516: 1514: 1509: 1504: 1503: 1502: 1473: 1471: 1470: 1465: 1333: 1329: 1327: 1326: 1321: 1319: 1314: 1305: 1291: 1272: 1270: 1269: 1264: 1262: 1257: 1248: 1246: 1245: 1240: 1238: 1237: 1233: 1224: 1223: 1219: 1190: 1188: 1187: 1182: 1161: 1159: 1158: 1153: 1128: 1126: 1125: 1120: 1112: 1107: 1106: 1091: 1086: 1075: 1070: 1069: 1060: 1055: 1050: 1045: 1037: 1032: 1024: 997: 995: 994: 989: 984: 947: 945: 944: 939: 911: 909: 908: 903: 875: 873: 872: 867: 850: 819: 817: 816: 811: 782: 780: 779: 774: 750: 748: 747: 742: 718: 714: 712: 711: 706: 688: 686: 685: 680: 597: 589: 587: 586: 581: 567: 566: 554: 553: 537: 533: 525: 523: 522: 517: 471: 469: 468: 463: 461: 460: 442: 441: 387: 385: 384: 379: 377: 376: 371: 367: 362: 351: 341: 340: 335: 331: 326: 315: 288: 286: 285: 280: 252: 250: 249: 244: 198: 196: 195: 190: 185: 184: 172: 171: 134:Pierre de Fermat 122: 115: 111: 108: 102: 100: 59: 35: 27: 21: 3484: 3483: 3479: 3478: 3477: 3475: 3474: 3473: 3459: 3458: 3457: 3452: 3438: 3373: 3335: 3302: 3259: 3203: 3160: 3064: 3026: 2999:Proth's theorem 2941:Primality tests 2935: 2927: 2883: 2852: 2844:Fermat (1894), 2843: 2840: 2835: 2834: 2818:10.2307/2005940 2798: 2793: 2792: 2788: 2783: 2711: 2667: 2662: 2661: 2650:quadratic sieve 2646: 2609: 2598: 2597: 2566: 2565: 2503: 2502: 2459: 2458: 2436: 2435: 2413: 2412: 2365: 2364: 2337: 2336: 2334:rational number 2306: 2305: 2295: 2275: 2233: 2202: 2197: 2196: 2161: 2130: 2125: 2124: 2070: 2069: 2062: 2041: 2036: 2035: 2031: 2010: 2005: 2004: 1977: 1972: 1971: 1967: 1959: 1932: 1927: 1926: 1841: 1836: 1835: 1810: 1809: 1806: 1703: 1698: 1697: 1662: 1657: 1656: 1591: 1586: 1585: 1556: 1551: 1550: 1527: 1526: 1487: 1482: 1481: 1444: 1443: 1308: 1307: 1297: 1290:= 2,345,678,917 1286: 1283: 1251: 1250: 1212: 1208: 1206: 1201: 1200: 1164: 1163: 1138: 1137: 1098: 1061: 1000: 999: 954: 953: 921: 920: 882: 881: 826: 825: 796: 795: 753: 752: 721: 720: 716: 691: 690: 665: 664: 558: 545: 540: 539: 535: 531: 502: 501: 498: 452: 433: 428: 427: 420: 352: 346: 345: 316: 310: 309: 298: 297: 262: 261: 208: 207: 176: 163: 152: 151: 123: 112: 106: 103: 60: 58: 48: 36: 23: 22: 15: 12: 11: 5: 3482: 3480: 3472: 3471: 3461: 3460: 3454: 3453: 3451: 3450: 3443: 3440: 3439: 3437: 3436: 3431: 3426: 3421: 3416: 3402: 3397: 3392: 3387: 3381: 3379: 3375: 3374: 3372: 3371: 3366: 3361: 3359:Tonelli–Shanks 3356: 3351: 3345: 3343: 3337: 3336: 3334: 3333: 3328: 3323: 3318: 3312: 3310: 3304: 3303: 3301: 3300: 3295: 3293:Index calculus 3290: 3288:Pohlig–Hellman 3285: 3280: 3275: 3269: 3267: 3261: 3260: 3258: 3257: 3252: 3247: 3242: 3240:Newton-Raphson 3237: 3232: 3227: 3222: 3216: 3214: 3205: 3204: 3202: 3201: 3196: 3191: 3186: 3181: 3176: 3170: 3168: 3166:Multiplication 3162: 3161: 3159: 3158: 3153: 3151:Trial division 3148: 3143: 3138: 3136:Rational sieve 3133: 3126: 3121: 3116: 3108: 3100: 3095: 3090: 3085: 3080: 3074: 3072: 3066: 3065: 3063: 3062: 3057: 3052: 3047: 3042: 3040:Sieve of Atkin 3036: 3034: 3028: 3027: 3025: 3024: 3019: 3014: 3009: 3002: 2995: 2988: 2981: 2976: 2971: 2966: 2964:Elliptic curve 2961: 2956: 2951: 2945: 2943: 2937: 2936: 2928: 2926: 2925: 2918: 2911: 2903: 2897: 2896: 2890: 2882: 2881:External links 2879: 2878: 2877: 2850: 2839: 2836: 2833: 2832: 2785: 2784: 2782: 2779: 2778: 2777: 2772: 2767: 2762: 2757: 2752: 2747: 2742: 2737: 2732: 2727: 2725:Factor theorem 2722: 2717: 2710: 2707: 2682: 2679: 2674: 2670: 2645: 2642: 2629: 2624: 2620: 2616: 2612: 2608: 2605: 2581: 2577: 2573: 2534: 2531: 2528: 2525: 2522: 2519: 2516: 2513: 2510: 2490: 2487: 2484: 2481: 2478: 2475: 2472: 2469: 2466: 2457:quickly. Then 2446: 2443: 2423: 2420: 2396: 2393: 2390: 2387: 2384: 2381: 2378: 2375: 2372: 2352: 2348: 2344: 2321: 2317: 2313: 2294: 2291: 2254: 2241: 2240: 2237: 2230: 2227: 2226: 2223: 2209: 2205: 2193: 2190: 2189: 2186: 2183: 2180: 2179: 2178:0, 1, 4, or 7 2176: 2173: 2169: 2168: 2165: 2158: 2155: 2154: 2151: 2137: 2133: 2121: 2118: 2117: 2114: 2111: 2108: 2107: 2106:0, 1, 4, or 9 2104: 2101: 2083: 2080: 2077: 2048: 2044: 2017: 2013: 1992: 1989: 1984: 1980: 1947: 1944: 1939: 1935: 1921: 1920: 1917: 1914: 1911: 1908: 1902: 1901: 1898: 1895: 1892: 1889: 1883: 1882: 1879: 1876: 1873: 1870: 1848: 1844: 1823: 1820: 1817: 1805: 1802: 1799: 1798: 1795: 1792: 1782: 1781: 1778: 1775: 1769: 1768: 1767:1,254,561,087 1765: 1762: 1756: 1755: 1752: 1749: 1726: 1723: 1717: 1714: 1711: 1706: 1685: 1682: 1676: 1673: 1670: 1665: 1642: 1639: 1634: 1628: 1625: 1622: 1617: 1611: 1605: 1602: 1599: 1594: 1570: 1567: 1564: 1559: 1536: 1512: 1507: 1501: 1498: 1495: 1490: 1463: 1460: 1457: 1454: 1451: 1430: 1429: 1426: 1423: 1420: 1417: 1407: 1406: 1403: 1400: 1397: 1394: 1388: 1387: 1384: 1381: 1378: 1375: 1369: 1368: 1365: 1362: 1359: 1356: 1350: 1349: 1346: 1343: 1340: 1337: 1317: 1282: 1279: 1260: 1236: 1232: 1228: 1222: 1218: 1215: 1211: 1180: 1177: 1174: 1171: 1151: 1148: 1145: 1118: 1115: 1111: 1105: 1101: 1097: 1094: 1089: 1084: 1081: 1078: 1074: 1068: 1064: 1058: 1053: 1048: 1043: 1040: 1035: 1030: 1027: 1023: 1019: 1016: 1013: 1010: 1007: 987: 983: 979: 976: 973: 970: 967: 964: 961: 937: 934: 931: 928: 901: 898: 895: 892: 889: 865: 862: 859: 856: 853: 849: 845: 842: 839: 836: 833: 809: 806: 803: 772: 769: 766: 763: 760: 740: 737: 734: 731: 728: 704: 701: 698: 678: 675: 672: 659: 658: 655: 652: 649: 643: 642: 639: 636: 633: 627: 626: 623: 620: 617: 611: 610: 607: 604: 601: 579: 576: 573: 570: 565: 561: 557: 552: 548: 515: 512: 509: 474: 459: 455: 451: 448: 445: 440: 436: 426:, hoping that 419: 416: 389: 388: 375: 370: 365: 361: 358: 355: 349: 344: 339: 334: 329: 325: 322: 319: 313: 308: 305: 278: 275: 272: 269: 242: 239: 236: 233: 230: 227: 224: 221: 218: 215: 206:factorable as 200: 199: 188: 183: 179: 175: 170: 166: 162: 159: 132:, named after 125: 124: 39: 37: 30: 24: 14: 13: 10: 9: 6: 4: 3: 2: 3481: 3470: 3467: 3466: 3464: 3448: 3445: 3444: 3441: 3435: 3432: 3430: 3427: 3425: 3422: 3420: 3417: 3414: 3410: 3406: 3403: 3401: 3398: 3396: 3393: 3391: 3388: 3386: 3383: 3382: 3380: 3376: 3370: 3367: 3365: 3362: 3360: 3357: 3355: 3354:Pocklington's 3352: 3350: 3347: 3346: 3344: 3342: 3338: 3332: 3329: 3327: 3324: 3322: 3319: 3317: 3314: 3313: 3311: 3309: 3305: 3299: 3296: 3294: 3291: 3289: 3286: 3284: 3281: 3279: 3276: 3274: 3271: 3270: 3268: 3266: 3262: 3256: 3253: 3251: 3248: 3246: 3243: 3241: 3238: 3236: 3233: 3231: 3228: 3226: 3223: 3221: 3218: 3217: 3215: 3213: 3210: 3206: 3200: 3197: 3195: 3192: 3190: 3187: 3185: 3182: 3180: 3177: 3175: 3172: 3171: 3169: 3167: 3163: 3157: 3154: 3152: 3149: 3147: 3144: 3142: 3139: 3137: 3134: 3132: 3131: 3127: 3125: 3122: 3120: 3117: 3115: 3113: 3109: 3107: 3105: 3101: 3099: 3098:Pollard's rho 3096: 3094: 3091: 3089: 3086: 3084: 3081: 3079: 3076: 3075: 3073: 3071: 3067: 3061: 3058: 3056: 3053: 3051: 3048: 3046: 3043: 3041: 3038: 3037: 3035: 3033: 3029: 3023: 3020: 3018: 3015: 3013: 3010: 3008: 3007: 3003: 3001: 3000: 2996: 2994: 2993: 2989: 2987: 2986: 2982: 2980: 2977: 2975: 2972: 2970: 2967: 2965: 2962: 2960: 2957: 2955: 2952: 2950: 2947: 2946: 2944: 2942: 2938: 2934: 2931: 2924: 2919: 2917: 2912: 2910: 2905: 2904: 2901: 2894: 2891: 2888: 2885: 2884: 2880: 2873: 2868: 2864: 2860: 2856: 2851: 2847: 2842: 2841: 2837: 2828: 2824: 2819: 2814: 2810: 2806: 2805: 2797: 2790: 2787: 2780: 2776: 2773: 2771: 2768: 2766: 2763: 2761: 2758: 2756: 2753: 2751: 2750:Factorization 2748: 2746: 2743: 2741: 2738: 2736: 2733: 2731: 2728: 2726: 2723: 2721: 2718: 2716: 2713: 2712: 2708: 2706: 2704: 2700: 2696: 2680: 2677: 2672: 2668: 2659: 2655: 2651: 2643: 2641: 2622: 2618: 2614: 2610: 2603: 2595: 2579: 2575: 2571: 2562: 2560: 2556: 2552: 2548: 2532: 2529: 2523: 2520: 2517: 2514: 2488: 2485: 2479: 2476: 2473: 2470: 2444: 2441: 2421: 2418: 2410: 2394: 2391: 2388: 2385: 2382: 2379: 2376: 2373: 2370: 2350: 2346: 2342: 2335: 2319: 2315: 2311: 2302: 2300: 2292: 2290: 2288: 2284: 2280: 2274: 2270: 2266: 2262: 2258: 2253: 2251: 2246: 2238: 2231: 2229: 2228: 2224: 2207: 2203: 2194: 2192: 2191: 2187: 2184: 2182: 2181: 2177: 2174: 2171: 2170: 2166: 2159: 2157: 2156: 2152: 2135: 2131: 2122: 2120: 2119: 2115: 2112: 2110: 2109: 2105: 2102: 2099: 2098: 2095: 2081: 2078: 2075: 2066: 2046: 2042: 2015: 2011: 1990: 1987: 1982: 1978: 1965: 1945: 1942: 1937: 1933: 1918: 1915: 1912: 1909: 1907: 1904: 1903: 1899: 1896: 1893: 1890: 1888: 1885: 1884: 1880: 1877: 1874: 1871: 1869: 1866: 1865: 1862: 1861:are squares: 1846: 1842: 1821: 1818: 1815: 1803: 1796: 1793: 1791: 1787: 1784: 1783: 1779: 1776: 1774: 1771: 1770: 1766: 1764:1,254,441,084 1763: 1761: 1758: 1757: 1753: 1750: 1748: 1745: 1744: 1741: 1738: 1724: 1721: 1704: 1683: 1680: 1663: 1640: 1637: 1632: 1615: 1609: 1592: 1557: 1534: 1510: 1505: 1488: 1478: 1475: 1461: 1458: 1455: 1452: 1449: 1441: 1437: 1427: 1424: 1421: 1418: 1416: 1412: 1409: 1408: 1404: 1401: 1398: 1395: 1393: 1390: 1389: 1385: 1382: 1379: 1376: 1374: 1371: 1370: 1366: 1363: 1360: 1357: 1355: 1352: 1351: 1347: 1344: 1341: 1338: 1335: 1334: 1331: 1315: 1304: 1300: 1295: 1289: 1278: 1276: 1258: 1234: 1230: 1226: 1220: 1216: 1213: 1209: 1198: 1194: 1175: 1169: 1162:), one needs 1149: 1146: 1143: 1135: 1130: 1116: 1113: 1109: 1103: 1095: 1092: 1087: 1079: 1076: 1072: 1066: 1056: 1051: 1046: 1038: 1033: 1028: 1025: 1021: 1014: 1011: 1008: 985: 981: 974: 971: 968: 962: 959: 951: 935: 932: 929: 926: 917: 915: 899: 896: 893: 890: 887: 879: 860: 857: 854: 847: 843: 840: 837: 834: 831: 823: 807: 804: 801: 793: 789: 784: 770: 767: 764: 761: 758: 738: 735: 732: 729: 726: 702: 699: 696: 676: 673: 670: 656: 653: 650: 648: 645: 644: 640: 637: 634: 632: 629: 628: 624: 621: 618: 616: 613: 612: 608: 605: 602: 599: 598: 595: 593: 577: 574: 571: 568: 563: 559: 555: 550: 546: 529: 513: 510: 507: 497: 494:a - sqrt(b2) 493: 489: 486: 482: 478: 473: 457: 453: 449: 446: 443: 438: 434: 425: 417: 415: 412: 410: 406: 402: 398: 395:is odd, then 394: 373: 368: 363: 359: 356: 353: 347: 342: 337: 332: 327: 323: 320: 317: 311: 306: 303: 296: 295: 294: 292: 276: 273: 270: 267: 258: 256: 237: 234: 231: 222: 219: 216: 205: 204:algebraically 186: 181: 177: 173: 168: 164: 160: 157: 150: 149: 148: 146: 142: 139: 135: 131: 121: 118: 110: 107:February 2022 99: 96: 92: 89: 85: 82: 78: 75: 71: 68: â€“  67: 63: 62:Find sources: 56: 52: 46: 45: 40:This article 38: 34: 29: 28: 19: 18:Fermat method 3446: 3140: 3128: 3111: 3103: 3022:Miller–Rabin 3004: 2997: 2990: 2985:Lucas–Lehmer 2983: 2862: 2858: 2845: 2808: 2802: 2789: 2745:Prime factor 2702: 2698: 2694: 2647: 2593: 2563: 2558: 2554: 2550: 2546: 2408: 2303: 2298: 2296: 2286: 2282: 2276: 2272: 2268: 2264: 2260: 2256: 2249: 2247: 2244: 2067: 1924: 1905: 1886: 1867: 1807: 1789: 1785: 1772: 1759: 1746: 1739: 1479: 1476: 1439: 1435: 1433: 1414: 1410: 1391: 1372: 1353: 1302: 1298: 1293: 1287: 1284: 1274: 1196: 1192: 1133: 1131: 949: 918: 913: 877: 821: 791: 787: 785: 662: 646: 630: 614: 591: 527: 499: 495: 491: 488: 484: 481:repeat until 480: 476: 472:, a square. 423: 421: 418:Basic method 413: 408: 404: 400: 396: 392: 390: 290: 259: 254: 201: 129: 128: 113: 104: 94: 87: 80: 73: 61: 49:Please help 44:verification 41: 3278:Pollard rho 3235:Goldschmidt 2969:Pocklington 2959:Baillie–PSW 2222:can only be 2175:Squares are 2150:can only be 2113:N mod 16 is 2103:Squares are 794:. That is, 3390:Cornacchia 3385:Chakravala 2933:algorithms 2838:References 2658:semiprimes 2545:. (Unless 2185:N mod 9 is 2100:modulo 16: 2082:2345678917 1822:2345678917 916:is prime. 411:be even.) 77:newspapers 3364:Berlekamp 3321:Euclidean 3209:Euclidean 3189:Toom–Cook 3184:Karatsuba 2730:FOIL rule 2678:− 2389:⋅ 2279:recursion 2172:modulo 9: 1988:− 1943:− 1797:24,582.2 1780:35,419.8 1638:− 1610:− 1453:− 1428:47,830.1 1093:− 1052:− 1029:− 897:⋅ 835:− 824:, and so 730:− 569:− 444:− 357:− 343:− 235:− 174:− 3463:Category 3331:Lehmer's 3225:Chunking 3212:division 3141:Fermat's 2709:See also 2557:divides 2549:divides 2277:But the 2259:modulus 1900:367,179 1794:24,582.9 1777:35,418.1 1425:47,915.1 1422:48,017.5 1419:48,156.3 1386:367,179 3447:Italics 3369:Kunerth 3349:Cipolla 3230:Fourier 3199:FĂŒrer's 3093:Euler's 3083:Dixon's 3006:PĂ©pin's 2827:2005940 2695:product 2236:must be 2164:must be 1897:270,308 1894:173,439 1881:48,436 1754:60,002 1462:47830.1 1383:270,308 1380:173,439 1367:48,436 538:. Then 293:, then 143:as the 141:integer 91:scholar 3429:Schoof 3316:Binary 3220:Binary 3156:Shor's 2974:Fermat 2825:  2640:time. 1964:modulo 1919:605.9 1891:76,572 1878:48,435 1875:48,434 1872:48,433 1751:60,001 1405:605.9 1377:76,572 1364:48,435 1361:48,434 1358:48,433 948:, let 492:return 391:Since 93:  86:  79:  72:  64:  3250:Short 2979:Lucas 2823:JSTOR 2799:(PDF) 2781:Notes 2273:enddo 2269:endif 2261:times 1916:519.9 1913:416.5 1910:276.7 1725:55000 1684:48436 1402:519.9 1399:416.5 1396:276.7 1249:from 654:16.79 651:11.18 600:Try: 98:JSTOR 84:books 3245:Long 3179:Long 2652:and 2501:and 2434:and 2232:and 2160:and 1549:and 1506:> 1348:4th 1336:Try 1296:and 919:For 790:and 751:and 719:are 717:5959 641:441 572:5959 532:5959 514:5959 407:and 399:and 70:news 3409:LLL 3255:SRT 3114:+ 1 3106:− 1 2954:APR 2949:AKS 2867:doi 2813:doi 2594:Nuv 2561:.) 2553:or 2509:gcd 2465:gcd 2409:Nuv 2195:so 2123:so 1345:3rd 1342:2nd 1339:1st 1132:If 771:101 657:21 638:282 635:125 625:80 578:125 483:b2 138:odd 53:by 3465:: 3413:KZ 3411:; 2863:68 2861:. 2857:. 2821:. 2809:28 2807:. 2801:. 2705:. 2301:. 2287:a' 2265:if 2257:do 2225:7 2188:7 2153:9 2116:5 2094:, 1788:− 1413:− 1301:− 1277:. 1129:. 783:. 739:59 703:21 689:, 677:80 622:79 619:78 609:3 560:78 536:78 485:is 257:. 147:: 3415:) 3407:( 3112:p 3104:p 2922:e 2915:t 2908:v 2875:. 2869:: 2829:. 2815:: 2703:n 2699:n 2681:n 2673:2 2669:a 2628:) 2623:3 2619:/ 2615:1 2611:N 2607:( 2604:O 2580:v 2576:/ 2572:u 2559:v 2555:d 2551:u 2547:c 2533:d 2530:= 2527:) 2524:u 2521:d 2518:, 2515:N 2512:( 2489:c 2486:= 2483:) 2480:v 2477:c 2474:, 2471:N 2468:( 2445:u 2442:d 2422:v 2419:c 2395:u 2392:d 2386:v 2383:c 2380:= 2377:v 2374:u 2371:N 2351:u 2347:/ 2343:v 2320:c 2316:/ 2312:d 2299:N 2283:a 2250:a 2234:a 2208:2 2204:a 2162:a 2136:2 2132:a 2079:= 2076:N 2063:b 2047:2 2043:b 2032:a 2016:2 2012:a 1991:N 1983:2 1979:a 1968:a 1960:a 1946:N 1938:2 1934:a 1906:b 1887:b 1868:a 1847:2 1843:b 1819:= 1816:N 1790:b 1786:a 1773:b 1760:b 1747:a 1722:= 1716:x 1713:a 1710:m 1705:a 1681:= 1675:x 1672:a 1669:m 1664:a 1641:N 1633:2 1627:x 1624:a 1621:m 1616:a 1604:x 1601:a 1598:m 1593:a 1569:x 1566:a 1563:m 1558:a 1535:N 1511:N 1500:x 1497:a 1494:m 1489:a 1459:= 1456:b 1450:a 1440:N 1436:b 1415:b 1411:a 1392:b 1373:b 1354:a 1316:N 1303:b 1299:a 1294:b 1288:N 1275:N 1259:N 1235:4 1231:/ 1227:1 1221:) 1217:N 1214:4 1210:( 1197:c 1193:N 1179:) 1176:N 1173:( 1170:O 1150:1 1147:= 1144:c 1134:N 1117:c 1114:2 1110:/ 1104:2 1100:) 1096:c 1088:N 1083:( 1080:= 1077:2 1073:/ 1067:2 1063:) 1057:c 1047:d 1042:( 1039:= 1034:N 1026:2 1022:/ 1018:) 1015:d 1012:+ 1009:c 1006:( 986:2 982:/ 978:) 975:d 972:+ 969:c 966:( 963:= 960:a 950:c 936:d 933:c 930:= 927:N 914:N 900:N 894:1 891:= 888:N 878:N 864:) 861:b 858:+ 855:a 852:( 848:/ 844:N 841:= 838:b 832:a 822:N 808:b 805:+ 802:a 792:b 788:a 768:= 765:b 762:+ 759:a 736:= 733:b 727:a 700:= 697:b 674:= 671:a 647:b 631:b 615:a 606:2 603:1 592:a 575:= 564:2 556:= 551:2 547:b 528:a 511:= 508:N 458:2 454:b 450:= 447:N 439:2 435:a 424:a 409:d 405:c 401:d 397:c 393:N 374:2 369:) 364:2 360:d 354:c 348:( 338:2 333:) 328:2 324:d 321:+ 318:c 312:( 307:= 304:N 291:N 277:d 274:c 271:= 268:N 255:N 241:) 238:b 232:a 229:( 226:) 223:b 220:+ 217:a 214:( 187:. 182:2 178:b 169:2 165:a 161:= 158:N 120:) 114:( 109:) 105:( 95:· 88:· 81:· 74:· 47:. 20:)

Index

Fermat method

verification
improve this article
adding citations to reliable sources
"Fermat's factorization method"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
Pierre de Fermat
odd
integer
difference of two squares
algebraically
modulo
recursion
rational number
quadratic sieve
general number field sieve
semiprimes
Completing the square
Factorization of polynomials
Factor theorem
FOIL rule
Monoid factorisation
Pascal's triangle
Prime factor

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

↑