Pollard's p − 1 algorithm

Pollard's p − 1 algorithm is a number theoretic integer factorization algorithm, invented by John Pollard in 1974. It is a special-purpose algorithm, meaning that it is only suitable for integers with specific types of factors; it is the simplest example of an algebraic-group factorisation algorithm.

The factors it finds are ones for which the number preceding the factor, p − 1, is powersmooth; the essential observation is that, by working in the multiplicative group modulo a composite number N, we are also working in the multiplicative groups modulo all of N's factors.

The existence of this algorithm leads to the concept of safe primes, being primes for which p − 1 is two times a Sophie Germain prime q and thus minimally smooth. These primes are sometimes construed as "safe for cryptographic purposes", but they might be unsafe — in current recommendations for cryptographic strong primes (e.g. ANSI X9.31), it is necessary but not sufficient that p − 1 has at least one large prime factor. Most sufficiently large primes are strong; if a prime used for cryptographic purposes turns out to be non-strong, it is much more likely to be through malice than through an accident of random number generation. This terminology is considered obsolete by the cryptography industry: the ECM factorization method is more efficient than Pollard's algorithm and finds safe prime factors just as quickly as it finds non-safe prime factors of similar size, thus the size of p is the key security parameter, not the smoothness of p-1.[1]

Base concepts

Let n be a composite integer with prime factor p. By Fermat's little theorem, we know that for all integers a coprime to p and for all positive integers K:

If a number x is congruent to 1 modulo a factor of n, then the gcd(x − 1, n) will be divisible by that factor.

The idea is to make the exponent a large multiple of p − 1 by making it a number with very many prime factors; generally, we take the product of all prime powers less than some limit B. Start with a random x, and repeatedly replace it by as w runs through those prime powers. Check at each stage, or once at the end if you prefer, whether gcd(x − 1, n) is not equal to 1.

Multiple factors

It is possible that for all the prime factors p of n, p − 1 is divisible by small primes, at which point the Pollard p − 1 algorithm simply returns n.

Algorithm and running time

The basic algorithm can be written as follows:

Inputs: n: a composite number
Output: a nontrivial factor of n or failure
  1. select a smoothness bound B
  2. define (note: explicitly evaluating M may not be necessary)
  3. randomly pick a positive integer, a, which is coprime to n (note: we can actually fix a, e.g. if n is odd, then we can always select a = 2, random selection here is not imperative)
  4. compute g = gcd(aM − 1, n) (note: exponentiation can be done modulo n)
  5. if 1 < g < n then return g
  6. if g = 1 then select a larger B and go to step 2 or return failure
  7. if g = n then select a smaller B and go to step 2 or return failure

If g = 1 in step 6, this indicates there are no prime factors p for which p-1 is B-powersmooth. If g = n in step 7, this usually indicates that all factors were B-powersmooth, but in rare cases it could indicate that a had a small order modulo n. Additionally, when the maximum prime factors of p-1 for each prime factors p of n are all the same in some rare cases, this algorithm will fail.

The running time of this algorithm is O(B × log B × log2 n); larger values of B make it run slower, but are more likely to produce a factor.

Example

If we want to factor the number n = 299.

  1. We select B = 5.
  2. Thus M = 22 × 31 × 51.
  3. We select a = 2.
  4. g = gcd(aM − 1, n) = 13.
  5. Since 1 < 13 < 299, thus return 13.
  6. 299 / 13 = 23 is prime, thus it is fully factored: 299 = 13 × 23.

Methods of choosing B

Since the algorithm is incremental, it is able to keep running with the bound constantly increasing.

Assume that p − 1, where p is the smallest prime factor of n, can be modelled as a random number of size less than n. By Dixon's theorem, the probability that the largest factor of such a number is less than (p − 1)1/ε is roughly εε; so there is a probability of about 3−3 = 1/27 that a B value of n1/6 will yield a factorisation.

In practice, the elliptic curve method is faster than the Pollard p − 1 method once the factors are at all large; running the p − 1 method up to B = 232 will find a quarter of all 64-bit factors and 1/27 of all 96-bit factors.

Two-stage variant

A variant of the basic algorithm is sometimes used; instead of requiring that p − 1 has all its factors less than B, we require it to have all but one of its factors less than some B1, and the remaining factor less than some B2B1. After completing the first stage, which is the same as the basic algorithm, instead of computing a new

for B2 and checking gcd(aM' − 1, n), we compute

where H = aM and check if gcd(Q, n) produces a nontrivial factor of n. As before, exponentiations can be done modulo n.

Let {q1, q2, …} be successive prime numbers in the interval (B1, B2] and dn = qn − qn−1 the difference between consecutive prime numbers. Since typically B1 > 2, dn are even numbers. The distribution of prime numbers is such that the dn will all be relatively small. It is suggested that dnln2 B2. Hence, the values of H2, H4, H6, … (mod n) can be stored in a table, and Hqn be computed from Hqn−1Hdn, saving the need for exponentiations.

Implementations

See also

References

  • Pollard, J. M. (1974). "Theorems of factorization and primality testing". Proceedings of the Cambridge Philosophical Society. 76 (3): 521–528. Bibcode:1974PCPS...76..521P. doi:10.1017/S0305004100049252. S2CID 122817056.
  • Montgomery, P. L.; Silverman, R. D. (1990). "An FFT extension to the P − 1 factoring algorithm". Mathematics of Computation. 54 (190): 839–854. Bibcode:1990MaCom..54..839M. doi:10.1090/S0025-5718-1990-1011444-3.
  • Samuel S. Wagstaff, Jr. (2013). The Joy of Factoring. Providence, RI: American Mathematical Society. pp. 138–141. ISBN 978-1-4704-1048-3.

Read other articles:

Status hukum persatuan sejenis Perkawinan Dilakukan Afrika Selatan Amerika Serikat1 Argentina Australia Austria* Belanda2 Belgia Brasil Britania Raya3 Chili Denmark Finlandia Irlandia Islandia Jerman Kanada Kolombia Kosta Rika Luksemburg Malta Meksiko: · 12 NB & CDMX Norwegia Prancis Portugal Selandia Baru4 Spanyol Swedia Taiwan* Uruguay Diakui Armenia Israel Meksiko5 Belanda:· AW, CW, SX6 Britania Raya:· Bermuda7 Persatuan sipil dan kemitraan terdaftar Andora Austria Belanda: · Aruba Br…

Stasiun Angkatan Laut Pearl HarborBagian dari Angkatan Laut Wilayah HawaiiOahu, Hawaii Stasiun Angkatan Laut Pearl HarborKoordinat21°20′57″N 157°56′38″W / 21.349270°N 157.943970°W / 21.349270; -157.943970JenisPangkalan militerInformasi situsDikontrol olehAngkatan Laut Amerika SerikatSejarah situsDigunakan1899–sekarang Pearl Harbor, Pangkalan Angkatan Laut Amerika SerikatDaftar Kawasan Bersejarah Nasional di ASU.S. National Historic Landmark DistrictPema…

19th-century group of American emigrants who became trapped in the Sierra Nevada mountains For other uses, see Donner Party (disambiguation). The 28th page of Patrick Breen's diary, recording his observations in late February 1847, including Mrs Murphy said here yesterday that thought she would Commence on Milt & eat him. I dont that she has done so yet, it is distressing. [sic] The Donner Party, sometimes called the Donner–Reed Party, were a group of American pioneers who migr…

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Notre Dame Roman Catholic Girls' School – news · newspapers · books · scholar · JSTOR (June 2020) (Learn how and when to remove this template message) Academy in Southwark, London, EnglandNotre Dame Roman Catholic Girls' SchoolAddress118 St George's RoadSouthwark,…

Inosensius IXAwal masa jabatan29 Oktober 1591Masa jabatan berakhir30 Desember 1591PendahuluGregorius XIVPenerusKlemens VIIIInformasi pribadiNama lahirGiovanni Antonio FacchinettiLahir20 Juli 1519Bologna, ItaliaWafat30 Desember 1591Roma, Italia Inosensius IX (20 Juli 1519 – 30 Desember 1591) adalah Paus yang menjabat sejak 29 Oktober 1591 sampai 30 Desember 1591. lbs Paus Gereja Katolik Daftar paus grafik masa jabatan orang kudus Nama Paus Abdikasi Paus Paus emeritus Antipaus Paus…

جعفر بن موسى الكاظم إحداثيات 33°53′47″N 48°46′14″E / 33.896388888889°N 48.770555555556°E / 33.896388888889; 48.770555555556   معلومات عامة الموقع بروجرد[1][2]  القرية أو المدينة بروجرد، محافظة لرستان الدولة  إيران الارتفاع عن سطح الأرض 25 متر[3]  تاريخ الافتتاح الرسمي 1317[2]…

Russian-Hungarian ice dancer In this name that follows Eastern Slavic naming customs, the patronymic is Olegovna and the family name is Ignateva. Mariia IgnatevaIgnateva with her partner Szemko at the 2024 World ChampionshipsFull nameMariia Olegovna IgnatevaNative nameМария Олеговна Игнатьева (Russian)Other namesMaria/Mariya Ignatieva/IgnatyevaBorn (2003-10-15) 15 October 2003 (age 20)Yekaterinburg, RussiaHometownYekaterinburg, RussiaHeight1.72 m (5 …

Canadian baseball player (1859–1938) Baseball player Joe KnightLeft fielderBorn: (1859-09-28)September 28, 1859Port Stanley, OntarioDied: October 16, 1938(1938-10-16) (aged 79)Lynhurst, OntarioBatted: LeftThrew: LeftMLB debutMay 16, 1884, for the Philadelphia QuakersLast MLB appearanceOctober 3, 1890, for the Cincinnati RedsMLB statisticsBatting average.309Home runs4Runs batted in69 Teams Philadelphia Quakers (1884) Cincinnati Reds (1890) Jonah William Quiet …

Синелобый амазон Научная классификация Домен:ЭукариотыЦарство:ЖивотныеПодцарство:ЭуметазоиБез ранга:Двусторонне-симметричныеБез ранга:ВторичноротыеТип:ХордовыеПодтип:ПозвоночныеИнфратип:ЧелюстноротыеНадкласс:ЧетвероногиеКлада:АмниотыКлада:ЗавропсидыКласс:Птиц…

Legends of Runeterra Publikasi29 April 2020GenrePermainan kartu koleksi daringLatar tempatLeague of Legends universe (en) Model bisnisFree-to-play Bahasa Daftar Inggris, Prancis, Rusia dan Spanyol 60 Karakteristik teknisSistem operasiAndroid dan iOS PlatformAndroid, iOS dan Windows UkuranWindows: 1.46 GB MesinUnity[1]Modepermainan video multipemain dan Permainan video pemain tunggal Formatunduhan digital dan distribusi digital Metode inputlayar sentuh Jumlah minimum pemain1 Jumlah maksim…

Sant'Angelo LodigianoKomuneCittà di Sant'Angelo LodigianoNegaraItaliaWilayahLombardyProvinsiLodi (LO)FrazioniDomodossola, Maiano, Malpensata, RaneraPemerintahan • Wali kotaDomenico CrespiLuas • Total20,0 km2 (80 sq mi)Populasi (Dec. 2004)[1] • Total12.684 • Kepadatan63/km2 (160/sq mi)DemonimSantangiolini or BarasiniZona waktuUTC+1 (CET) • Musim panas (DST)UTC+2 (CEST)Kode pos26866Kode area telepon0371Sa…

For the video game, see History of Biology (video game). The frontispiece to Erasmus Darwin's evolution-themed poem The Temple of Nature shows a goddess pulling back the veil from nature (in the person of Artemis). Allegory and metaphor have often played an important role in the history of biology. Part of a series onBiologyScience of life Index Outline Glossary History (timeline) Key components Cell theory Ecosystem Evolution Phylogeny Properties of life Adaptation Energy processing Growth Orde…

Raphaël Géminiani Raphaël Géminiani al Tour de France 1954 Nazionalità  Francia Ciclismo Specialità Strada Termine carriera 1960 Carriera Squadre di club 1946-1948 Métropole1949 Métropole Stucchi1950-1951 Métropole Bottecchia1952 Métropole Bianchi1953 Rochet Bianchi1954Ideor1954-1957 Saint-Raphaël1958 Saint-Raphaël1959 Rapha1960 Saint-Raphaël Nazionale 1947-1959 Francia Carriera da allenatore 1962-1964 Saint-…

American politician (born 1941) Don SherwoodMember of the U.S. House of Representativesfrom Pennsylvania's 10th districtIn officeJanuary 3, 1999 – January 3, 2007Preceded byJoe McDadeSucceeded byChris Carney Personal detailsBorn (1941-03-05) March 5, 1941 (age 83)Nicholson, Pennsylvania, U.S.Political partyRepublicanSpouseCarol EvansResidence(s)Tunkhannock, Pennsylvania, U.S.Alma materDartmouth CollegeOccupationAutomobile dealer Donald Lewis Sherwood[1] (born …

Questa voce sull'argomento fumettisti statunitensi è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Roger Stern Roger Stern (Noblesville, 17 settembre 1950) è un fumettista e scrittore statunitense. È divenuto famoso per essere il creatore del personaggio di Hobgoblin, un nemico di Spider-Man, oltre che per i suoi cicli di storie su fumetti della Marvel Comics come Il Dottor Strange, Capitan America, I Vendicatori e soprattutto per il già citato Uomo Ra…

Bagian dari seri tentangHierarki Gereja KatolikSanto Petrus Gelar Gerejawi (Jenjang Kehormatan) Paus Kardinal Kardinal Kerabat Kardinal pelindung Kardinal mahkota Kardinal vikaris Moderator kuria Kapelan Sri Paus Utusan Sri Paus Kepala Rumah Tangga Kepausan Nunsio Apostolik Delegatus Apostolik Sindik Apostolik Visitor apostolik Vikaris Apostolik Eksarkus Apostolik Prefek Apostolik Asisten Takhta Kepausan Eparkus Metropolitan Batrik Uskup Uskup agung Uskup emeritus Uskup diosesan Uskup agung utam…

Union Army general For other people with the same name, see Charles Phelps. Charles Edward PhelpsJudge of the Circuit Court of BaltimoreIn office1882–1908Member of theU.S. House of Representativesfrom Maryland's 3rd congressional districtIn officeMarch 4, 1865 – March 3, 1869Preceded byHenry Winter DavisSucceeded byThomas SwannMember of theBaltimore City CouncilIn office1860–1861 Personal detailsBorn(1833-05-01)May 1, 1833Guilford, Vermont, USDiedDecember 27, 1908(1908-12-27) (age…

Frei in 2012 Christian Frei (kelahiran tahun 1959 di Schönenwerd, Solothurn) adalah seorang pembuat film dan produser film asal Swiss. Ia banyak dikenal atas film-filmnya War Photographer (2001), The Giant Buddhas[1] (2005) dan Space Tourists (2009). Sejak tahun 2006, Frei telah menjadi dosen asosiasi tentang Kompetensi Refleksi di Universitas St. Gallen. Dari 2006 sampai 2009, ia menjadi presiden “Komisi Film Dokumenter” untuk seksi film dari Kementerian Budaya Swiss. Pada Agustus …

Tan Lioe IeLahir(1958-06-01)1 Juni 1958 Denpasar, BaliPekerjaanSastrawanTahun aktif1980 - sekarangSuami/istriIda Ayu Nyoman Suwiti Tan Lioe Ie Hanzi tradisional: 陳六一 Alih aksara Mandarin - Hanyu Pinyin: Chén Liù Yī Min Nan - Romanisasi POJ: Tân Lio̍k-it Nama Indonesia Indonesia: Tan Lioe Ie Tan Lioe Ie (lahir 1 Juni 1958) adalah seorang penyair Indonesia terkenal asal Bali. Ia merupakan penyair pertama Indonesia yang melakukan eksplorasi atas ritual dan mitologi Tionghoa dalam pu…

1947 film by Dore Schary, Irving Reis The Bachelor and the Bobby-SoxerTheatrical release posterDirected byIrving ReisWritten bySidney SheldonProduced byDore ScharyStarringCary GrantMyrna LoyShirley TempleCinematographyNicholas MusuracaRobert De GrasseEdited byFrederic KnudtsonMusic byLeigh HarlineProductioncompanyVanguard FilmsDistributed byRKO Radio PicturesRelease dates July 24, 1947 (1947-07-24) (Premiere-NYC)[1] September 1, 1947 (1947-09-01) (US…

Kembali kehalaman sebelumnya