[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-504629-105":59,"doc-detail-504629-en":130},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","fast-primality-testing-for-integers-that-fit-into-a-machine-word","Fast Primality Testing for Integers That Fit into a Machine Word","","Fast primality testing focuses on how to determine whether large integers are prime. For very large inputs, probabilistic algorithms are most efficient, while for integers with a small fixed bit-length, deterministic methods are preferred. The paper establishes one-shot deterministic tests: for 32-bit integers, it reduces the process to a single hash computation plus one Miller-Rabin round; for 64-bit integers it reduces to two rounds with a precomputed table or three rounds.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":40,"@type":76,"position":81},"https://docshare.wps.com/document/research-report/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/fast-primality-testing-for-integers-that-fit-into-a-machine-word/504629/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/fast-primality-testing-for-integers-that-fit-into-a-machine-word/504629.png","ImageObject",300,407,{"name":92,"@type":93},"4398046744996","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-16","2026-10-03",true,{"@type":102,"interactionType":103,"userInteractionCount":29},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"Why are probabilistic primality tests usually preferred for very large integers?","Question",{"text":112,"@type":113},"For large integers, the most efficient primality testing methods are probabilistic. They can be fast and, while they have a small chance of error for composites, they often work well in practice.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What deterministic result does the paper give for 32-bit integers?",{"text":117,"@type":113},"For 32-bit integers, the paper reduces deterministic testing to one computation of a simple hash function and a single round of the Miller-Rabin test.",{"name":119,"@type":110,"acceptedAnswer":120},"How does the paper reduce Miller-Rabin rounds for 64-bit integers?",{"text":121,"@type":113},"For 64-bit integers, the number of Miller-Rabin rounds can be reduced to two with a significantly large precomputed table, or to three without relying on that reduction.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},504629,1792178312,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":66,"doc_module":4,"category_id":39,"category_name":40,"doc_title":65,"doc_description":67,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":29,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":138,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":143,"read_time":144,"preview_page_count":19,"preview_urls":145},4398046744996,"Fast Primality Testing for Integers That Fit into  \na Machine Word?  \nMichal Fori􀀔sek and Jakub Jan􀀔cina  \nComenius University, Bratislava, Slovakia,  \n[forisek@dcs.fmph.uniba.sk](forisek@dcs.fmph.uniba.sk), [jakub.jancina@gmail.com](jakub.jancina@gmail.com)  \nAbstract. For large integers, the most e􀀎cient primality tests are probabilistic. However, for integers with a small 􀀌xed number of bits the best tests in practice are deterministic. Currently the best known tests of this type involve 3 rounds of the Miller-Rabin test for 32-bit integers and 7 rounds for 64-bit integers. Our main result in this paper: For 32-bit integers we reduce this to a single computation of a simple hash function and a single round of Miller-Rabin. Similarly, for 64-bit integers we can reduce the number of rounds to two (but with a signi􀀌cantly large precomputed table) or three. Up to our knowledge, our implementations are the fastest one-shot deterministic primality tests for 32-bit and 64-bit integers to date.  \nWe also provide empirical evidence that our algorithms are fast in practice and that the data segment is roughly as small as possible for an algorithm of this type.  \n1 Overview  \nIn this section we give an overview of relevant topics related to primality testing.  \n1.1 Large Primes, Deterministic Tests  \nSince the seminal result by Agrawal, Kayal, and Saxena in 2002, we know that primality testing is in P. Their original paper [1] gives an algorithm that runs in~O(log 12 n) when testing whether n is a prime.1 A more recent paper by Pomerance and Lenstra [10] improves this to ~O(log6 n) . While certainly interesting from a theoretical point of view, these algorithms are rarely used in practice. For instance, in most cryptographic applications primes with log 2 n 􀀙 1000 are quite common, and the known deterministic tests are way too slow for numbers of this magnitude.  \n? The research is partially funded by the VEGA grant V-12-031-00 .  \n1 Here, ~O(f(n)) formally denotes the class Sk O (f(n) logk f (n)) .  \nFast Primality Testing... 21  \n1.2 Large Primes, Probabilistic Tests  \nFor large primes, the state of the art are general unconditional probabilistic tests. Here, \\general\" means that they work for all possible n, and \\unconditional\"means that their correctness does not depend on any unproved hypothesis (such as the generalized Riemann hypothesis) . Most of these tests only have a one-sided error: for prime n they always report the correct answer, but for composite n they have a small probability of incorrectly reporting that n is prime.  \nThe two most notable tests with this property are the Solovay-Strassen test ([14], Theorem 1 below) and the Miller-Rabin test ([11, 13], Theorem 2 below) .  \nTheorem 1 (Solovay, Strassen) . For a given odd integer n > 3: Choose an integer a uniformly at random from2 [2; n 􀀀 1] .  \nCompute x = a (n􀀀1)=2 mod n, and the Jacobi symbol for a and n: j = 􀀀 ~~a~~n􀀁 . If n is prime, we always have j  0 and x = j.  \nIf n is composite, with probability at least 1/2 we have j = 0 or x  j .  \nDe􀀌nition 1 . Let n 􀀀 1 = 2sd with d odd and s non-negative. The positive integer n is called a strong probable-prime with base b (b-SPRP) if either bd 􀀑 1 (mod n), or (bd )2r 􀀑 􀀀 1 (mod n) for some r 2 [0; s 􀀀 1] .  \nIf n is a composite b-SPRP, we call it a strong pseudoprime with base b.  \nTheorem 2 (Rabin, Monier) . For a given odd integer n > 3: Choose an integer b uniformly at random from [2; n 􀀀 2] .  \nIf n is prime, then n is also a b-SPRP.  \nIf n is composite, with probability at least 3/4 it is not a b-SPRP.  \nThe Solovay-Strassen test can be implemented in O(log3 n) by using exponentiation by squaring and the law of quadratic reciprocity to compute the Jacobi symbol. The Miller-Rabin test can be implemented in ~O(log2 n) using FFT-based multiplication of big integers.  \nNote that each test can be repeated arbitrarily many times: e.g. , k independent runs of the Miller-Rabin test decrease the probability of error to 4","cbCaif4oTWDoIAfk","https://ap.wps.com/l/cbCaif4oTWDoIAfk","pdf",303099,11,"English","# Overview\n## Large Primes, Deterministic Tests\n## Large Primes, Probabilistic Tests\n## Small Primes, Applications\n## Small Primes, Deterministic Tests","[{\"question\":\"Why are probabilistic primality tests usually preferred for very large integers?\",\"answer\":\"For large integers, the most efficient primality testing methods are probabilistic. They can be fast and, while they have a small chance of error for composites, they often work well in practice.\"},{\"question\":\"What deterministic result does the paper give for 32-bit integers?\",\"answer\":\"For 32-bit integers, the paper reduces deterministic testing to one computation of a simple hash function and a single round of the Miller-Rabin test.\"},{\"question\":\"How does the paper reduce Miller-Rabin rounds for 64-bit integers?\",\"answer\":\"For 64-bit integers, the number of Miller-Rabin rounds can be reduced to two with a significantly large precomputed table, or to three without relying on that reduction.\"}]","Fast Primality Testing for Integers That Fit into a Machine Word | PDF",1791071364,28,[146,150,154,158],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/466c11ce0fd1c492951cb61f1ad1373d.webp",983,1272,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/1ffa311a8d2cc3db57f61925e7506a65.webp",982,1270,{"page_no":81,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/ea8e7ae00d0d90b0cd98d991a1f20776.webp",981,1269,{"page_no":19,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/ecf52dfd90f46ecb99e38ae59d049b89.webp",980,1268]