🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 178 (from laksa106)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
11 hours ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.infoworld.com/article/3568675/the-power-of-prime-numbers-in-computing.html
Last Crawled2026-04-18 17:37:48 (11 hours ago)
First Indexed2024-10-23 09:07:59 (1 year ago)
HTTP Status Code200
Meta TitleThe power of prime numbers in computing | InfoWorld
Meta DescriptionA basic feature of number theory, prime numbers are also a fundamental building block of computer science, from hashtables to cryptography.
Meta Canonicalnull
Boilerpipe Text
how-to Oct 23, 2024 9 mins Everyone knows that a prime number is one that cannot be made by multiplying other whole numbers together. This deceptively simple attribute hides a world of complexity that has engaged mathematicians ancient and modern. This quality of primes also has essential applications in computer science and the realm of cryptography. The Fundamental Theorem of Arithmetic Like its name implies, the Fundamental Theorem of Arithmetic says something profound about the way numbers behave. It says that every number can be described as the product of a specific set of primes multiplied together. This is a curious result that comes from the basic definition of prime . I say “curious” because it is at once a surprising and useful fact: a somewhat hidden but also almost direct outcome of the definition of primeness. This kind of mental maneuver, where you take the properties of mathematical objects and keep extrapolating out their ramifications, leads eventually to essential cryptographic algorithms like Diffie-Hellman , RSA , and Elliptic curve. The Fundamental Theorem of Arithmetic tells us that every number (besides 1) is either prime itself or the unique product of primes. As a simple example, consider the number 25: 25 = 5 * 5 In other words, 25’s “prime signature” is 5 * 5. Only 25 has that signature and 5 * 5 only comes out to 25. If you think about the entire range of whole numbers—that is, the infinitude of integers—you’ll see that the theorem guarantees us an enormous space of uniquely identifiable instances. Take an arbitrary number and ask the question: What is its prime factorization? That is, what is its prime signature ? The answer to that question turns out to be very difficult, especially when compared with the inverse operation, of creating a number that is the product of two known primes. The fundamental theorem underpins this difficulty because it means in the entire space of numbers, each number has but one set of prime factors. It also means that brute-force attacking such problems is not feasible. For 25, of course, you can just figure out 5 * 5, but what about a number with a thousand digits? It is computationally unfeasible to guess at the factors. Primes in hash functions Another interesting area where primes pop up in coding is creating hash functions. In a hash function, the primary job is to take an input and transform it into a number that stands in its place. The number is a reduction of the overall input, and this fact makes it useful for many things like checksums and structures like hashtables. Hashing for a hashtable (the hash function for the object being placed into the collection; i.e., Java’s hashCode ) uses a modulo of a constant, and that constant is recommended to be a prime. In that case, using a prime for the constant can help reduce the likelihood of collisions. That’s because the primeness of the number makes for a more even distribution of modulus, because there are fewer common denominators with the hashtable’s function. For the same reason, a prime on the hashtable “bucket count” helps prevent asymmetric collisions. In essence, using primes on the hashing constant and bucket count helps to ensure a good random distribution of items in buckets by reducing the likelihood of significant relationships between the two. The discussion of this relationship on Stack Overflow is a nice launch pad for further investigation on the topic of primes and hashes. Another fertile ground of primes and hashing working together is in functions like SHA-256 and MD5. These are used all over the place for things like hashing passwords and as elements of cryptocurrency. SHA 256 from scratch with pen and paper is a fun walkthrough of doing SHA-256 by hand, as part of the process of building a Bitcoin key from scratch. It highlights the role primes play. Primes and modular math Another fascinating area of math with many implications for programming is modular math. This is sometimes called “clock math” because it takes a finite range of numbers and counts only what is leftover. An example is the way we use the numbers from 1 to 12 on the clock and only use the excess, so that 13 hours becomes 1 o’clock (assuming we begin at 12). Modular math crops up in many areas, especially cryptography, and using primes with it is often necessary to attain the necessary properties, like having a multiplicative inverse . Cambridge University Press has a great breakdown of primes as moduli . Sieve of Eratosthenes Now let’s flip things around a bit and look at how coding helps us handle and understand one of the classic problems of math: discovering primeness. An ancient algorithm was described by Eratosthenes, working in the 3rd century BC. The algorithm, now called the Sieve of Eratosthenes , provides a set of steps for finding all the primes for a given number. The basic idea behind the algorithm is to take a number, n , and through a series of passes, eliminate the non-prime numbers. What remains when you’re done is the set of primes you are after. There are many possible ways to refine this process, but the basic modern version of the sieve begins by taking 2 and noting it as prime, then finding all the even numbers up to n , noting them as not prime. Then, we move to 3 and perform the same thing for multiples of 3. Continuing on, we do the same for all the numbers up to n , only skipping those numbers we have already noted as non-prime. This is a very ancient example of an algorithm, and a programmer’s ability to put it into an executable format is a superpower, for sure. Here is a version in JavaScript (from Wikipedia ): function getPrimeNumbers ( max ) { var isPrime = []; for ( var i = 0 ; i < max; i += 1 ) { if (i != 0 && i != 1 ) { isPrime. push ( true ); } else { isPrime. push ( false ); } } for ( var i = 0 ; i < max; i += 1 ) { if (isPrime[i]) { for ( var j = i + i; j < max; j += i) { isPrime[j] = false ; } } } var primes = []; for ( var i = 0 ; i < max; i += 1 ) { if (isPrime[i]) { primes. push (i); } } return primes; } Many other approaches to discovering the primes for a given field have been developed, including the Sieve of Atkin and fascinating approaches to probabilistic testing of primality like the Miller–Rabin primality test ( seen here in C++ ). Its probabilistic nature means Miller-Rabin is fast—O(k log3 n)—but may sometimes give false positives. So, the algorithm for finding primes is well-known and even simple to code. It is astounding that despite the initial simplicity and millennia of attention from some of the most brilliant mathematical minds, the characteristics and nature of primes remain a mysterious and active area of research. The Riemann Hypothesis One of the most interesting unsolved problems in math is the Riemann Hypothesis (here’s the codebase for calculating it ). Riemann was a student of Gauss , whose name you might know from the “Gaussian blur” in software like Adobe Photoshop. Gauss devised a function to estimate the occurrence of primes, known now as the Prime Number Theorem . Reimann’s function, called the zeta function , incorporates complex numbers into its infinite series and increases the accuracy of the Gauss theorem. The Riemann Hypothesis sheds light on the fundamental behavior of numbers, and how it impacts computer science is an open question. Proving the hypothesis is perhaps the most prominent effort in theoretical math. Alan Turing is probably the most well-known figure at the point where mathematics and computing meet. (Turing’s paper on the computability of numbers provided the conceptual basis for modern computers.) He had a long and profound relationship with primes and in particular the Riemann Hypothesis . He was working on building a Riemann Hypothesis machine when he was interrupted by the outbreak of World War II, where he applied lessons from that endeavor to the task of constructing an analytical machine to crack the Nazi cyphers. Turing’s final paper addressed the Riemann zeta function . Prime numbers in quantum computing Quantum computing may one day threaten current cryptographic practices in a systematic way . One of the chief reasons is that qubits may—if the hardware can be worked out—eventually be able to rattle off prime numbers, reducing the computation time required to perform Diffie-Hellman-like functions in the reverse direction. Conclusion This article has surveyed many of the areas where prime math and computer science come together. It’s an incredibly interesting area because it begins with such simplicity, but ties directly into highly sophisticated realms of number theory that are at the forefront of research. Programming and primes will continue to inform each other in a back-and-forth of influences for as long as we are using computers. This is especially true in cryptography, where a central facet is the nature and behavior of primes. Contributing Writer Matthew Tyson is a contributing writer at InfoWorld. A seasoned technology journalist and expert in enterprise software development, Matthew has written about programming, programming languages, language frameworks, application platforms, development tools, databases, cryptography, information security, cloud computing, and emerging technologies such as blockchain and machine learning for more than 15 years. His work has appeared in leading publications including InfoWorld, CIO, CSO Online, and IBM developerWorks. Matthew also has had the privilege of interviewing many tech luminaries including Brendan Eich, Grady Booch, Guillermo Rauch, and Martin Hellman. Matthew’s diverse background encompasses full-stack development (Java, JVM languages such as Kotlin, JavaScript, Python, .NET), front-end development (Angular, React, Vue, Svelte) and back-end development (Spring Boot, Node.js, Django), software architecture, and IT infrastructure at companies ranging from startups to Fortune 500 enterprises. He is a trusted authority in critical technology areas such as database design (SQL and NoSQL), AI-assisted coding, agentic AI, open-source initiatives, enterprise integration, and cloud platforms, providing insightful analysis and practical guidance rooted in real-world experience. More from this author
Markdown
1. Topics 2. [Latest](https://www.infoworld.com/news/) 3. [Newsletters](https://www.infoworld.com/newsletters/signup/) 4. [Resources](https://us.resources.infoworld.com/) 5. [Buyer’s Guides](https://www.infoworld.com/enterprise-buyers-guide/) 6. [Events](https://www.infoworld.com/events/) [Search](https://www.infoworld.com/search/) Menu [Search](https://www.infoworld.com/search/) Menu ## Topics Close 1. [Analytics](https://www.infoworld.com/analytics/) 2. [Artificial Intelligence](https://www.infoworld.com/artificial-intelligence/) 3. [Careers](https://www.infoworld.com/careers/) 4. [Cloud Computing](https://www.infoworld.com/cloud-computing/) 5. [Data Management](https://www.infoworld.com/data-management/) 6. [Databases](https://www.infoworld.com/database/) 7. [Development Tools](https://www.infoworld.com/development-tools/) 8. [Devops](https://www.infoworld.com/devops/) 9. [Emerging Technology](https://www.infoworld.com/emerging-technology/) 10. [Enterprise Buyer’s Guides](https://www.infoworld.com/enterprise-buyers-guide/) 11. [Generative AI](https://www.infoworld.com/generative-ai/) 12. [IT Leadership](https://www.infoworld.com/it-leadership/) 13. [Java](https://www.infoworld.com/java/) 14. [JavaScript](https://www.infoworld.com/javascript/) 15. [Microsoft .NET](https://www.infoworld.com/microsoft-net/) 16. [Open Source](https://www.infoworld.com/open-source/) 17. [Programming Languages](https://www.infoworld.com/programming-languages/) 18. [Python](https://www.infoworld.com/python/) 19. [Security](https://www.infoworld.com/security/) 20. [Software Development](https://www.infoworld.com/software-development/) 21. [Technology Industry](https://www.infoworld.com/technology-business/) Back Close [Search](https://www.infoworld.com/search/) Topics [Latest](https://www.infoworld.com/news/) [Newsletters](https://www.infoworld.com/newsletters/signup/) [Resources](https://us.resources.infoworld.com/) [Buyer’s Guides](https://www.infoworld.com/enterprise-buyers-guide/) More 1. [Features](https://www.infoworld.com/features/) 2. [Blogs](https://www.infoworld.com/blogs/) 3. [BrandPosts](https://www.infoworld.com/brandposts/) 4. [Videos](https://www.infoworld.com/videos/) Topics Topics 1. [Analytics](https://www.infoworld.com/analytics/) 2. [Artificial Intelligence](https://www.infoworld.com/artificial-intelligence/) 3. [Careers](https://www.infoworld.com/careers/) 4. [Cloud Computing](https://www.infoworld.com/cloud-computing/) 5. [Data Management](https://www.infoworld.com/data-management/) 6. [Databases](https://www.infoworld.com/database/) 7. [Development Tools](https://www.infoworld.com/development-tools/) 8. [Devops](https://www.infoworld.com/devops/) 9. [Emerging Technology](https://www.infoworld.com/emerging-technology/) 10. [Enterprise Buyer’s Guides](https://www.infoworld.com/enterprise-buyers-guide/) 11. [Generative AI](https://www.infoworld.com/generative-ai/) 12. [IT Leadership](https://www.infoworld.com/it-leadership/) 13. [Java](https://www.infoworld.com/java/) 14. [JavaScript](https://www.infoworld.com/javascript/) 15. [Microsoft .NET](https://www.infoworld.com/microsoft-net/) 16. [Open Source](https://www.infoworld.com/open-source/) 17. [Programming Languages](https://www.infoworld.com/programming-languages/) 18. [Python](https://www.infoworld.com/python/) 19. [Security](https://www.infoworld.com/security/) 20. [Software Development](https://www.infoworld.com/software-development/) 21. [Technology Industry](https://www.infoworld.com/technology-business/) 1. [Home](https://www.infoworld.com/) 2. [Software Development](https://www.infoworld.com/software-development/) ![Matthew Tyson](https://www.infoworld.com/wp-content/uploads/2026/04/2019-0-24884200-1776157352-author_photo_Matthew-Tyson_1750190297.png?w=150) by [Matthew Tyson](https://www.infoworld.com/profile/matthew-tyson/) Contributing Writer # The power of prime numbers in computing how-to Oct 23, 20249 mins ## A basic feature of number theory, prime numbers are also a fundamental building block of computer science, from hashtables to cryptography. ![An old-fashioned clock whose numbers morph into a spiral.](https://www.infoworld.com/wp-content/uploads/2024/10/3568675-0-96828800-1729674141-shutterstock_156672833.jpg?quality=50&strip=all&w=1024) Credit: ltummy / Shutterstock Everyone knows that a prime number is one that cannot be made by multiplying other whole numbers together. This deceptively simple attribute hides a world of complexity that has engaged mathematicians ancient and modern. This quality of primes also has essential applications in computer science and the realm of cryptography. ## The Fundamental Theorem of Arithmetic Like its name implies, the *Fundamental Theorem of Arithmetic* says something profound about the way numbers behave. It says that every number can be described as the product of a specific set of primes multiplied together. This is a curious result that comes from the basic definition of *prime*. I say “curious” because it is at once a surprising and useful fact: a somewhat hidden but also almost direct outcome of the definition of primeness. This kind of mental maneuver, where you take the properties of mathematical objects and keep extrapolating out their ramifications, leads eventually to essential cryptographic algorithms like [Diffie-Hellman](https://www.infoworld.com/article/2334365/understand-diffie-hellman-key-exchange.html), [RSA](https://www.infoworld.com/article/2334511/understand-the-rsa-encryption-algorithm.html), and Elliptic curve. The *Fundamental Theorem of Arithmetic* tells us that every number (besides 1) is either prime itself or the unique product of primes. As a simple example, consider the number 25: 25 = 5 \* 5 In other words, 25’s “prime signature” is 5 \* 5. Only 25 has that signature and 5 \* 5 only comes out to 25. If you think about the entire range of whole numbers—that is, the infinitude of integers—you’ll see that the theorem guarantees us an enormous space of uniquely identifiable instances. Take an arbitrary number and ask the question: What is its prime factorization? That is, what is its *prime signature*? The answer to that question turns out to be very difficult, especially when compared with the inverse operation, of creating a number that is the product of two known primes. The fundamental theorem underpins this difficulty because it means in the entire space of numbers, each number has but one set of prime factors. It also means that brute-force attacking such problems is not feasible. For 25, of course, you can just figure out 5 \* 5, but what about a number with a thousand digits? It is computationally unfeasible to guess at the factors. ## Primes in hash functions Another interesting area where primes pop up in coding is creating hash functions. In a hash function, the primary job is to take an input and transform it into a number that stands in its place. The number is a reduction of the overall input, and this fact makes it useful for many things like checksums and structures like hashtables. Hashing for a hashtable (the hash function for the object being placed into the collection; i.e., Java’s `hashCode`) uses a modulo of a constant, and that constant is recommended to be a prime. In that case, using a prime for the constant can help reduce the likelihood of collisions. That’s because the primeness of the number makes for a more even distribution of modulus, because there are fewer common denominators with the hashtable’s function. For the same reason, a prime on the hashtable “bucket count” helps prevent asymmetric collisions. In essence, using primes on the hashing constant and bucket count helps to ensure a good random distribution of items in buckets by reducing the likelihood of significant relationships between the two. The discussion of this relationship on [Stack Overflow](https://stackoverflow.com/questions/1145217/why-should-hash-functions-use-a-prime-number-modulus) is a nice launch pad for further investigation on the topic of primes and hashes. Another fertile ground of primes and hashing working together is in functions like SHA-256 and MD5. These are used all over the place for things like hashing passwords and as elements of cryptocurrency. [SHA 256 from scratch with pen and paper](https://armantheparman.com/sha256) is a fun walkthrough of doing SHA-256 by hand, as part of the process of building a Bitcoin key from scratch. It highlights the role primes play. ## Primes and modular math Another fascinating area of math with many implications for programming is modular math. This is sometimes called “clock math” because it takes a finite range of numbers and counts only what is leftover. An example is the way we use the numbers from 1 to 12 on the clock and only use the excess, so that 13 hours becomes 1 o’clock (assuming we begin at 12). Modular math crops up in many areas, especially cryptography, and using primes with it is often necessary to attain the necessary properties, like having a [multiplicative inverse](https://en.wikipedia.org/wiki/Multiplicative_inverse). Cambridge University Press has [a great breakdown of primes as moduli](https://www.cambridge.org/engage/coe/article-details/5ff31864c8dcf80018d959d6). ## Sieve of Eratosthenes Now let’s flip things around a bit and look at how coding helps us handle and understand one of the classic problems of math: discovering primeness. An ancient algorithm was described by Eratosthenes, working in the 3rd century BC. The algorithm, now called the *Sieve of Eratosthenes*, provides a set of steps for finding all the primes for a given number. The basic idea behind the algorithm is to take a number, *n*, and through a series of passes, eliminate the non-prime numbers. What remains when you’re done is the set of primes you are after. There are many possible ways to refine this process, but the basic modern version of the sieve begins by taking 2 and noting it as prime, then finding all the even numbers up to *n*, noting them as not prime. Then, we move to 3 and perform the same thing for multiples of 3. Continuing on, we do the same for all the numbers up to *n*, only skipping those numbers we have already noted as non-prime. This is a very ancient example of an algorithm, and a programmer’s ability to put it into an executable format is a superpower, for sure. Here is a version in JavaScript (from [Wikipedia](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)): ``` function getPrimeNumbers(max) { // A list of booleans where index 2 being true corresponds to 2 being prime var isPrime = []; // Initial population of isPrime for (var i = 0; i < max; i += 1) { if (i != 0 && i != 1) { isPrime.push(true); } else { isPrime.push(false); } } // Iterate over entire list // Element => true if index is prime else false for (var i = 0; i < max; i += 1) { if (isPrime[i]) { for (var j = i + i; j < max; j += i) { isPrime[j] = false; } } } var primes = []; // Assemble list of primes for (var i = 0; i < max; i += 1) { if (isPrime[i]) { primes.push(i); } } return primes; } ``` Many other approaches to discovering the primes for a given field have been developed, including the [Sieve of Atkin](https://en.wikipedia.org/wiki/Sieve_of_Atkin) and fascinating approaches to probabilistic testing of primality like the Miller–Rabin primality test ([seen here in C++](https://github.com/cslarsen/miller-rabin)). Its probabilistic nature means Miller-Rabin is fast—O(k log3 n)—but may sometimes give false positives. So, the algorithm for finding primes is well-known and even simple to code. It is astounding that despite the initial simplicity and millennia of attention from some of the most brilliant mathematical minds, the characteristics and nature of primes remain a mysterious and active area of research. ## The Riemann Hypothesis One of the most interesting unsolved problems in math is the *Riemann Hypothesis* (here’s the [codebase for calculating it](https://github.com/stdlib-js/math-base-special-riemann-zeta)). Riemann was a student of [Gauss](https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss), whose name you might know from the “Gaussian blur” in software like Adobe Photoshop. Gauss devised a function to estimate the occurrence of primes, known now as the *Prime Number Theorem*. Reimann’s function, called the *zeta function*, incorporates complex numbers into its infinite series and increases the accuracy of the Gauss theorem. The *Riemann Hypothesis* sheds light on the fundamental behavior of numbers, and how it impacts computer science is an open question. Proving the hypothesis is perhaps the most prominent effort in theoretical math. Alan Turing is probably the most well-known figure at the point where mathematics and computing meet. (Turing’s [paper on the computability of numbers](https://www.infoworld.com/article/2335689/9-extraordinary-documents-every-developer-should-read.html) provided the conceptual basis for modern computers.) He had a long and profound relationship with primes and in particular the *Riemann Hypothesis*. He was [working on building a Riemann Hypothesis machine](https://www.turing.org.uk/sources/zetamachine.html) when he was interrupted by the outbreak of World War II, where he applied lessons from that endeavor to the task of constructing an analytical machine to crack the Nazi cyphers. Turing’s final paper addressed the [Riemann zeta function](https://www-users.cse.umn.edu/~odlyzko/doc/turing.zeta.pdf). ## Prime numbers in quantum computing Quantum computing may one day threaten current cryptographic practices [in a systematic way](https://www.infoworld.com/article/2335266/the-quantum-menace-quantum-computing-and-cryptography.html). One of the chief reasons is that qubits may—if the hardware can be worked out—eventually be able to rattle off prime numbers, reducing the computation time required to perform Diffie-Hellman-like functions in the reverse direction. ## Conclusion This article has surveyed many of the areas where prime math and computer science come together. It’s an incredibly interesting area because it begins with such simplicity, but ties directly into highly sophisticated realms of number theory that are at the forefront of research. Programming and primes will continue to inform each other in a back-and-forth of influences for as long as we are using computers. This is especially true in cryptography, where a central facet is the nature and behavior of primes. [Software Development](https://www.infoworld.com/software-development/) ## Related content [feature Exciting Python features are on the way By Serdar Yegulalp Apr 17, 2026 2 mins Programming Languages Python Software Development](https://www.infoworld.com/article/4159295/exciting-python-features-are-on-the-way.html) [opinion The agent tier: Rethinking runtime architecture for context-driven enterprise workflows By Nitesh Varma Apr 16, 2026 12 mins Artificial Intelligence Development Approaches Software Development](https://www.infoworld.com/article/4158536/the-agent-tier-rethinking-runtime-architecture-for-context-driven-enterprise-workflows.html) [opinion The two-pass compiler is back – this time, it’s fixing AI code generation By Vijay Pullur Apr 16, 2026 5 mins Artificial Intelligence Development Tools Generative AI](https://www.infoworld.com/article/4154577/the-two-pass-compiler-is-back-this-time-its-fixing-ai-code-generation.html) [analysis Ease into Azure Kubernetes Application Network By Simon Bisson Apr 16, 2026 9 mins Cloud-Native Kubernetes Microsoft Azure](https://www.infoworld.com/article/4155954/ease-into-azure-kubernetes-application-network.html) ## Other Sections - [Resources](https://us.resources.infoworld.com/) - [Videos](https://www.infoworld.com/videos/) - [Spotlight: IT Leadership](https://www.infoworld.com/it-leadership/) ![Matthew Tyson](https://www.infoworld.com/wp-content/uploads/2026/04/2019-0-24884200-1776157352-author_photo_Matthew-Tyson_1750190297.png?w=250) by [Matthew Tyson](https://www.infoworld.com/profile/matthew-tyson/) Contributing Writer Matthew Tyson is a contributing writer at InfoWorld. A seasoned technology journalist and expert in enterprise software development, Matthew has written about programming, programming languages, language frameworks, application platforms, development tools, databases, cryptography, information security, cloud computing, and emerging technologies such as blockchain and machine learning for more than 15 years. His work has appeared in leading publications including InfoWorld, CIO, CSO Online, and IBM developerWorks. Matthew also has had the privilege of interviewing many tech luminaries including Brendan Eich, Grady Booch, Guillermo Rauch, and Martin Hellman. Matthew’s diverse background encompasses full-stack development (Java, JVM languages such as Kotlin, JavaScript, Python, .NET), front-end development (Angular, React, Vue, Svelte) and back-end development (Spring Boot, Node.js, Django), software architecture, and IT infrastructure at companies ranging from startups to Fortune 500 enterprises. He is a trusted authority in critical technology areas such as database design (SQL and NoSQL), AI-assisted coding, agentic AI, open-source initiatives, enterprise integration, and cloud platforms, providing insightful analysis and practical guidance rooted in real-world experience. ## More from this author - [featureHTMX 4.0: Hypermedia finds a new gear Apr 14, 2026 8 mins](https://www.infoworld.com/article/4150864/htmx-4-0-hypermedia-finds-a-new-gear.html) - [analysisLocal-first browser data gets real Apr 3, 2026 4 mins](https://www.infoworld.com/article/4154031/local-first-browser-data-gets-real.html) - [feature9 reasons Java is still great Mar 19, 2026 10 mins](https://www.infoworld.com/article/2335996/9-reasons-java-is-still-great.html) - [analysisWhy local-first matters for JavaScript Mar 6, 2026 3 mins](https://www.infoworld.com/article/4140812/why-local-first-matters-for-javascript.html) - [featureThe revenge of SQL: How a 50-year-old language reinvents itself Mar 5, 2026 9 mins](https://www.infoworld.com/article/4140734/the-revenge-of-sql-how-a-50-year-old-language-reinvents-itself.html) - [featureThe browser is your database: Local-first comes of age Feb 26, 2026 10 mins](https://www.infoworld.com/article/4133648/the-browser-is-your-database-local-first-comes-of-age.html) - [featureWinterTC: Write once, run anywhere (for real this time) Feb 19, 2026 8 mins](https://www.infoworld.com/article/4133640/wintertc-write-once-run-anywhere-for-real-this-time.html) - [featureReactive state management with JavaScript Signals Feb 12, 2026 9 mins](https://www.infoworld.com/article/4129648/reactive-state-management-with-javascript-signals.html) ## Show me more Popular Articles Videos [news Oracle delivers semantic search without LLMs By Anirban Ghoshal Apr 17, 20264 mins Data ManagementDatabases ![Image](https://www.infoworld.com/wp-content/uploads/2026/04/4160436-0-19757700-1776445695-oraicle_clouldworld.jpg?quality=50&strip=all&w=375)](https://www.infoworld.com/article/4160436/oracle-delivers-semantic-search-without-llms.html) [opinion When cloud giants neglect resilience By David Linthicum Apr 17, 20265 mins Business ContinuityHybrid CloudMulticloud ![Image](https://www.infoworld.com/wp-content/uploads/2026/04/4159225-0-08418900-1776416526-shutterstock_1823843783-100929990-orig-100946177-orig.jpg?quality=50&strip=all&w=375)](https://www.infoworld.com/article/4159225/when-cloud-giants-neglect-resilience.html) [news Anthropic’s latest model is deliberately less powerful than Mythos (and that’s the point) By Taryn Plumb Apr 16, 20266 mins Artificial IntelligenceCode SecuritySecurity ![Image](https://www.infoworld.com/wp-content/uploads/2026/04/4160043-0-69313600-1776458468-shutterstock_editorial_2338803257.jpg?quality=50&strip=all&w=444)](https://www.infoworld.com/article/4160043/anthropics-latest-model-is-deliberately-less-powerful-than-mythos-and-thats-the-point-2.html) [video How to run Chrome and Edge's built-in AI Apr 14, 20266 mins Python ![Image](https://www.infoworld.com/wp-content/uploads/2026/04/4158712-0-01163900-1776197449-youtube-thumbnail-sJtCIiXZxNc_8ef18a.jpg?quality=50&strip=all&w=444)](https://www.infoworld.com/video/4158712/how-to-run-chrome-and-edges-built-in-ai.html) [video Python's new frozendict type Apr 2, 20264 mins Python ![Image](https://www.infoworld.com/wp-content/uploads/2026/04/4153873-0-51930400-1775143797-youtube-thumbnail-CD_8mAIdH9M_ddd0a5.jpg?quality=50&strip=all&w=444)](https://www.infoworld.com/video/4153873/pythons-new-frozendict-type.html) [video How to boost app performance with Python 3.15's lazy import Mar 31, 20266 mins Python ![Image](https://www.infoworld.com/wp-content/uploads/2026/03/4152630-0-43887000-1774980243-youtube-thumbnail-XMHBeBs64cg_fd88a0.jpg?quality=50&strip=all&w=444)](https://www.infoworld.com/video/4152630/how-to-boost-app-performance-with-python-3-15s-lazy-import.html) ### About 1. [About Us](https://www.infoworld.com/about-us/) 2. [Advertise](https://foundryco.com/our-brands/infoworld/) 3. [Contact Us](https://www.infoworld.com/contact-us/) 4. [Editorial Ethics Policy](https://www.infoworld.com/editorial-ethics-policy/) 5. [Foundry Careers](https://foundryco.com/work-here/) 6. [Newsletters](https://www.infoworld.com/newsletters/signup/) 7. [Reprints](https://www.infoworld.com/contact-us/#republication-permissions) 8. [Add InfoWorld as a Preferred Source in Google Search](https://www.google.com/preferences/source?q=infoworld.com) ### Policies 1. [Terms of Service](https://foundryco.com/terms-of-service-agreement/) 2. [Privacy Policy](https://foundryco.com/privacy-policy/) 3. [Cookie Policy](https://foundryco.com/cookie-policy/) 4. [Copyright Notice](https://foundryco.com/copyright-notice/) 5. [Member Preferences](https://www.infoworld.com/member-preferences/) 6. [About AdChoices](https://foundryco.com/ad-choices/) 7. [Your California Privacy Rights](https://foundryco.com/ccpa/) 8. [Privacy Settings]() ### More 1. [News](https://www.infoworld.com/news/) 2. [Features](https://www.infoworld.com/features/) 3. [Blogs](https://www.infoworld.com/blogs/) 4. [BrandPosts](https://www.infoworld.com/brandposts/) 5. [Events](https://www.infoworld.com/events/) 6. [Videos](https://www.infoworld.com/videos/) 7. [Enterprise Buyer’s Guides](https://www.infoworld.com/enterprise-buyers-guide/) ### Our Network 1. [CIO](https://www.cio.com/) 2. [Computerworld](https://www.computerworld.com/) 3. [CSO](https://www.csoonline.com/) 4. [Network World](https://www.networkworld.com/) - [Facebook](https://www.facebook.com/InfoWorld) - [X](https://twitter.com/infoworld) - [YouTube](https://www.youtube.com/@InfoWorld) - [Google News](https://news.google.com/publications/CAAqIggKIhxDQkFTRHdvSkwyMHZNRFY1ZEhaNUVnSmxiaWdBUAE) - [LinkedIn](https://www.linkedin.com/company/164364) [© 2026 FoundryCo, Inc. All Rights Reserved.](https://foundryco.com/terms-of-service-agreement/)
Readable Markdown
how-to Oct 23, 20249 mins Everyone knows that a prime number is one that cannot be made by multiplying other whole numbers together. This deceptively simple attribute hides a world of complexity that has engaged mathematicians ancient and modern. This quality of primes also has essential applications in computer science and the realm of cryptography. ## The Fundamental Theorem of Arithmetic Like its name implies, the *Fundamental Theorem of Arithmetic* says something profound about the way numbers behave. It says that every number can be described as the product of a specific set of primes multiplied together. This is a curious result that comes from the basic definition of *prime*. I say “curious” because it is at once a surprising and useful fact: a somewhat hidden but also almost direct outcome of the definition of primeness. This kind of mental maneuver, where you take the properties of mathematical objects and keep extrapolating out their ramifications, leads eventually to essential cryptographic algorithms like [Diffie-Hellman](https://www.infoworld.com/article/2334365/understand-diffie-hellman-key-exchange.html), [RSA](https://www.infoworld.com/article/2334511/understand-the-rsa-encryption-algorithm.html), and Elliptic curve. The *Fundamental Theorem of Arithmetic* tells us that every number (besides 1) is either prime itself or the unique product of primes. As a simple example, consider the number 25: 25 = 5 \* 5 In other words, 25’s “prime signature” is 5 \* 5. Only 25 has that signature and 5 \* 5 only comes out to 25. If you think about the entire range of whole numbers—that is, the infinitude of integers—you’ll see that the theorem guarantees us an enormous space of uniquely identifiable instances. Take an arbitrary number and ask the question: What is its prime factorization? That is, what is its *prime signature*? The answer to that question turns out to be very difficult, especially when compared with the inverse operation, of creating a number that is the product of two known primes. The fundamental theorem underpins this difficulty because it means in the entire space of numbers, each number has but one set of prime factors. It also means that brute-force attacking such problems is not feasible. For 25, of course, you can just figure out 5 \* 5, but what about a number with a thousand digits? It is computationally unfeasible to guess at the factors. ## Primes in hash functions Another interesting area where primes pop up in coding is creating hash functions. In a hash function, the primary job is to take an input and transform it into a number that stands in its place. The number is a reduction of the overall input, and this fact makes it useful for many things like checksums and structures like hashtables. Hashing for a hashtable (the hash function for the object being placed into the collection; i.e., Java’s `hashCode`) uses a modulo of a constant, and that constant is recommended to be a prime. In that case, using a prime for the constant can help reduce the likelihood of collisions. That’s because the primeness of the number makes for a more even distribution of modulus, because there are fewer common denominators with the hashtable’s function. For the same reason, a prime on the hashtable “bucket count” helps prevent asymmetric collisions. In essence, using primes on the hashing constant and bucket count helps to ensure a good random distribution of items in buckets by reducing the likelihood of significant relationships between the two. The discussion of this relationship on [Stack Overflow](https://stackoverflow.com/questions/1145217/why-should-hash-functions-use-a-prime-number-modulus) is a nice launch pad for further investigation on the topic of primes and hashes. Another fertile ground of primes and hashing working together is in functions like SHA-256 and MD5. These are used all over the place for things like hashing passwords and as elements of cryptocurrency. [SHA 256 from scratch with pen and paper](https://armantheparman.com/sha256) is a fun walkthrough of doing SHA-256 by hand, as part of the process of building a Bitcoin key from scratch. It highlights the role primes play. ## Primes and modular math Another fascinating area of math with many implications for programming is modular math. This is sometimes called “clock math” because it takes a finite range of numbers and counts only what is leftover. An example is the way we use the numbers from 1 to 12 on the clock and only use the excess, so that 13 hours becomes 1 o’clock (assuming we begin at 12). Modular math crops up in many areas, especially cryptography, and using primes with it is often necessary to attain the necessary properties, like having a [multiplicative inverse](https://en.wikipedia.org/wiki/Multiplicative_inverse). Cambridge University Press has [a great breakdown of primes as moduli](https://www.cambridge.org/engage/coe/article-details/5ff31864c8dcf80018d959d6). ## Sieve of Eratosthenes Now let’s flip things around a bit and look at how coding helps us handle and understand one of the classic problems of math: discovering primeness. An ancient algorithm was described by Eratosthenes, working in the 3rd century BC. The algorithm, now called the *Sieve of Eratosthenes*, provides a set of steps for finding all the primes for a given number. The basic idea behind the algorithm is to take a number, *n*, and through a series of passes, eliminate the non-prime numbers. What remains when you’re done is the set of primes you are after. There are many possible ways to refine this process, but the basic modern version of the sieve begins by taking 2 and noting it as prime, then finding all the even numbers up to *n*, noting them as not prime. Then, we move to 3 and perform the same thing for multiples of 3. Continuing on, we do the same for all the numbers up to *n*, only skipping those numbers we have already noted as non-prime. This is a very ancient example of an algorithm, and a programmer’s ability to put it into an executable format is a superpower, for sure. Here is a version in JavaScript (from [Wikipedia](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)): ``` function getPrimeNumbers(max) { var isPrime = []; for (var i = 0; i < max; i += 1) { if (i != 0 && i != 1) { isPrime.push(true); } else { isPrime.push(false); } } for (var i = 0; i < max; i += 1) { if (isPrime[i]) { for (var j = i + i; j < max; j += i) { isPrime[j] = false; } } } var primes = []; for (var i = 0; i < max; i += 1) { if (isPrime[i]) { primes.push(i); } } return primes; } ``` Many other approaches to discovering the primes for a given field have been developed, including the [Sieve of Atkin](https://en.wikipedia.org/wiki/Sieve_of_Atkin) and fascinating approaches to probabilistic testing of primality like the Miller–Rabin primality test ([seen here in C++](https://github.com/cslarsen/miller-rabin)). Its probabilistic nature means Miller-Rabin is fast—O(k log3 n)—but may sometimes give false positives. So, the algorithm for finding primes is well-known and even simple to code. It is astounding that despite the initial simplicity and millennia of attention from some of the most brilliant mathematical minds, the characteristics and nature of primes remain a mysterious and active area of research. ## The Riemann Hypothesis One of the most interesting unsolved problems in math is the *Riemann Hypothesis* (here’s the [codebase for calculating it](https://github.com/stdlib-js/math-base-special-riemann-zeta)). Riemann was a student of [Gauss](https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss), whose name you might know from the “Gaussian blur” in software like Adobe Photoshop. Gauss devised a function to estimate the occurrence of primes, known now as the *Prime Number Theorem*. Reimann’s function, called the *zeta function*, incorporates complex numbers into its infinite series and increases the accuracy of the Gauss theorem. The *Riemann Hypothesis* sheds light on the fundamental behavior of numbers, and how it impacts computer science is an open question. Proving the hypothesis is perhaps the most prominent effort in theoretical math. Alan Turing is probably the most well-known figure at the point where mathematics and computing meet. (Turing’s [paper on the computability of numbers](https://www.infoworld.com/article/2335689/9-extraordinary-documents-every-developer-should-read.html) provided the conceptual basis for modern computers.) He had a long and profound relationship with primes and in particular the *Riemann Hypothesis*. He was [working on building a Riemann Hypothesis machine](https://www.turing.org.uk/sources/zetamachine.html) when he was interrupted by the outbreak of World War II, where he applied lessons from that endeavor to the task of constructing an analytical machine to crack the Nazi cyphers. Turing’s final paper addressed the [Riemann zeta function](https://www-users.cse.umn.edu/~odlyzko/doc/turing.zeta.pdf). ## Prime numbers in quantum computing Quantum computing may one day threaten current cryptographic practices [in a systematic way](https://www.infoworld.com/article/2335266/the-quantum-menace-quantum-computing-and-cryptography.html). One of the chief reasons is that qubits may—if the hardware can be worked out—eventually be able to rattle off prime numbers, reducing the computation time required to perform Diffie-Hellman-like functions in the reverse direction. ## Conclusion This article has surveyed many of the areas where prime math and computer science come together. It’s an incredibly interesting area because it begins with such simplicity, but ties directly into highly sophisticated realms of number theory that are at the forefront of research. Programming and primes will continue to inform each other in a back-and-forth of influences for as long as we are using computers. This is especially true in cryptography, where a central facet is the nature and behavior of primes. ![Matthew Tyson](https://www.infoworld.com/wp-content/uploads/2026/04/2019-0-24884200-1776157352-author_photo_Matthew-Tyson_1750190297.png?w=250) Contributing Writer Matthew Tyson is a contributing writer at InfoWorld. A seasoned technology journalist and expert in enterprise software development, Matthew has written about programming, programming languages, language frameworks, application platforms, development tools, databases, cryptography, information security, cloud computing, and emerging technologies such as blockchain and machine learning for more than 15 years. His work has appeared in leading publications including InfoWorld, CIO, CSO Online, and IBM developerWorks. Matthew also has had the privilege of interviewing many tech luminaries including Brendan Eich, Grady Booch, Guillermo Rauch, and Martin Hellman. Matthew’s diverse background encompasses full-stack development (Java, JVM languages such as Kotlin, JavaScript, Python, .NET), front-end development (Angular, React, Vue, Svelte) and back-end development (Spring Boot, Node.js, Django), software architecture, and IT infrastructure at companies ranging from startups to Fortune 500 enterprises. He is a trusted authority in critical technology areas such as database design (SQL and NoSQL), AI-assisted coding, agentic AI, open-source initiatives, enterprise integration, and cloud platforms, providing insightful analysis and practical guidance rooted in real-world experience. More from this author
Shard178 (laksa)
Root Hash11067585635464083778
Unparsed URLcom,infoworld!www,/article/3568675/the-power-of-prime-numbers-in-computing.html s443