# primes

Published articles for primes.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Deterministic Primality Testing for Limited Bit Width

DevFeed: [Deterministic Primality Testing for Limited Bit Width](<https://devfeed.tech/articles/deterministic-primality-testing-for-limited-bit-width-40494.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2026/04/07/deterministic-miller-rabin/>)

Published: 2026-04-07T13:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Mathematics](<https://devfeed.tech/topics/mathematics.md>), [Cryptography](<https://devfeed.tech/topics/cryptography.md>), [homomorphic encryption](<https://devfeed.tech/topics/homomorphic-encryption.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [code](<https://devfeed.tech/tags/code.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [homomorphic-encryption](<https://devfeed.tech/tags/homomorphic-encryption.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [miller-rabin](<https://devfeed.tech/tags/miller-rabin.md>), [oeis](<https://devfeed.tech/tags/oeis.md>), [primes](<https://devfeed.tech/tags/primes.md>), [programming](<https://devfeed.tech/tags/programming.md>), [randomized-algorithm](<https://devfeed.tech/tags/randomized-algorithm.md>)

### AI overview

This article explains how to perform deterministic Miller-Rabin primality testing for 32-bit integers. It presents C++ code using the bases 2, 3, 5, and 7, which the article states is deterministic for all 32-bit inputs, and discusses strong pseudoprimes and related research.

### Source excerpt

Problem: Determine if a 32-bit number is prime (deterministically) Solution: (in C++) // Bases to test. Using the first 4 prime bases makes the test deterministic // for all 32-bit integers. See https://oeis.org/A014233. int64_t bases[] = {2, 3, 5, 7}; inline int countTrailingZeros(uint64_t n) { if (n == 0) return 64; return __builtin_ctzll(n); } int64_t modularExponentiation(int64_t base, int64_t exponent, int64_t modulus) { int64_t res = 1; int64_t b = base % modulus; int64_t e = exponent; while (e > 0) { if (e & 1) { // Doesn't overflow because we assume 32-bit integer inputs res = (res * b) % modulus; } b = (b * b) % modulus; e >>= 1; } return res; } bool isPrime(int64_t n) { if (n < 2) return false; if (n < 4) return true; if (!

## Miller-Rabin Primality Test

DevFeed: [Miller-Rabin Primality Test](<https://devfeed.tech/articles/miller-rabin-primality-test-40323.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2013/06/16/miller-rabin-primality-test/>)

Published: 2013-06-16T18:55:40Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Algorithms, Complexity](<https://devfeed.tech/topics/algorithms-complexity.md>), [Cryptography](<https://devfeed.tech/topics/cryptography.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [complexity-theory](<https://devfeed.tech/tags/complexity-theory.md>), [computational-complexity](<https://devfeed.tech/tags/computational-complexity.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [miller-rabin](<https://devfeed.tech/tags/miller-rabin.md>), [primes](<https://devfeed.tech/tags/primes.md>), [probabilistic](<https://devfeed.tech/tags/probabilistic.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [random-number-generators](<https://devfeed.tech/tags/random-number-generators.md>), [randomized-algorithm](<https://devfeed.tech/tags/randomized-algorithm.md>), [rsa](<https://devfeed.tech/tags/rsa.md>)

### AI overview

This tutorial explains the Miller-Rabin primality test, including its probabilistic error bound, Python implementation, and role in testing whether numbers are prime. It also discusses the algorithm's relevance to cryptography and complexity theory.

### Source excerpt

Problem: Determine if a number is prime, with an acceptably small error rate. Solution: (in Python) import random def decompose(n): exponentOfTwo = 0 while n % 2 == 0: n = n/2 exponentOfTwo += 1 return exponentOfTwo, n def isWitness(possibleWitness, p, exponent, remainder): possibleWitness = pow(possibleWitness, remainder, p) if possibleWitness == 1 or possibleWitness == p - 1: return False for _ in range(exponent): possibleWitness = pow(possibleWitness, 2, p) if possibleWitness == p - 1: return False return True def probablyPrime(p, accuracy=100): if p == 2 or p == 3: return True if p < 2: return False exponent, remainder = decompose(p - 1) for _ in range(accuracy): possibleWitness = random.

## There are Infinitely Many Primes (Erdős)

DevFeed: [There are Infinitely Many Primes (Erdős)](<https://devfeed.tech/articles/there-are-infinitely-many-primes-erdos-40291.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2012/11/10/there-are-infinitely-many-primes-erdos/>)

Published: 2012-11-10T13:48:52Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [primes](<https://devfeed.tech/topics/primes.md>)

Tags: [limits](<https://devfeed.tech/tags/limits.md>), [lower-bounds](<https://devfeed.tech/tags/lower-bounds.md>), [number](<https://devfeed.tech/tags/number.md>), [primes](<https://devfeed.tech/tags/primes.md>), [product](<https://devfeed.tech/tags/product.md>), [square](<https://devfeed.tech/tags/square.md>)

### AI overview

A proof by Paul Erdős establishes that infinitely many primes exist by bounding the number of factorizations of integers as a square-free number times a square. This yields π(n) >= 1/2 log(n), which grows without bound.

### Source excerpt

Problem: Prove there are infinitely many primes Solution: Denote by $ \pi(n)$ the number of primes less than or equal to $ n$. We will give a lower bound on $ \pi(n)$ which increases without bound as $ n \to \infty$. Note that every number $ n$ can be factored as the product of a square free number $ r$ (a number which no square divides) and a square $ s^2$.

## Complete Sequences and Magic Tricks

DevFeed: [Complete Sequences and Magic Tricks](<https://devfeed.tech/articles/complete-sequences-and-magic-tricks-40288.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2012/10/02/complete-sequences-and-magic-tricks/>)

Published: 2012-10-02T11:28:16Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Sequences](<https://devfeed.tech/topics/sequences.md>), [Algorithm](<https://devfeed.tech/topics/algorithm.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [code](<https://devfeed.tech/tags/code.md>), [dynamic-programming](<https://devfeed.tech/tags/dynamic-programming.md>), [greedy-algorithm](<https://devfeed.tech/tags/greedy-algorithm.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [numberphile](<https://devfeed.tech/tags/numberphile.md>), [primes](<https://devfeed.tech/tags/primes.md>), [programming](<https://devfeed.tech/tags/programming.md>), [sequences](<https://devfeed.tech/tags/sequences.md>)

### AI overview

This tutorial explains complete integer sequences through a card trick inspired by a Numberphile video. It presents a greedy algorithm that generates the cards and selects the smallest representation of each number, then shows how to implement the method in JavaScript.

### Source excerpt

Numberphile posted a video today describing a neat trick based on complete sequences: The mathematics here is pretty simple, but I noticed at the end of the video that Dr. Grime was constructing the cards by hand, when really this is a job for a computer program. I thought it would be a nice warmup exercise (and a treat to all of the Numberphile viewers) to write a program to construct the cards for any complete sequence.

## Infinitely Many Primes (Using Topology)

DevFeed: [Infinitely Many Primes (Using Topology)](<https://devfeed.tech/articles/infinitely-many-primes-using-topology-40287.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2012/09/26/infinitely-many-primes-using-topology/>)

Published: 2012-09-26T11:51:28Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Sequences](<https://devfeed.tech/topics/sequences.md>), [structure](<https://devfeed.tech/topics/structure.md>)

Tags: [arithmetic](<https://devfeed.tech/tags/arithmetic.md>), [numbers](<https://devfeed.tech/tags/numbers.md>), [primes](<https://devfeed.tech/tags/primes.md>), [sequence](<https://devfeed.tech/tags/sequence.md>), [using](<https://devfeed.tech/tags/using.md>)

### AI overview

A proof that there are infinitely many prime numbers using a topology on the integers whose basis consists of two-sided arithmetic progressions. Assuming finitely many primes leads to a finite open complement, contradicting the fact that no finite set is open in this topology.

### Source excerpt

Problem: Prove there are infinitely many prime numbers. Solution: First recall that an arithmetic progression with difference $ d$ is a sequence of integers $ a_n \subset \mathbb{Z}$ so that for every pair $ a_k, a_{k+1}$ the difference $ a_{k+1} - a_k = d$. We proceed be defining a topology on the set of integers by defining a basis $ B$ of unbounded (in both directions) arithmetic progressions. That is, an open set in this topology is an arbitrary union of arithmetic progressions from $ -\infty$ to $ \infty$.

## The Smallest Non-Cyclic Simple Group has Order 60

DevFeed: [The Smallest Non-Cyclic Simple Group has Order 60](<https://devfeed.tech/articles/the-smallest-non-cyclic-simple-group-has-order-60-40244.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2011/10/08/the-smallest-non-cyclic-simple-group-has-order-60/>)

Published: 2011-10-08T20:53:48Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Mathematics](<https://devfeed.tech/topics/mathematics.md>), [Math and Logic](<https://devfeed.tech/topics/math-and-logic.md>)

Tags: [classification](<https://devfeed.tech/tags/classification.md>), [group-theory](<https://devfeed.tech/tags/group-theory.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [primes](<https://devfeed.tech/tags/primes.md>), [simple-groups](<https://devfeed.tech/tags/simple-groups.md>), [theory](<https://devfeed.tech/tags/theory.md>)

### AI overview

A mathematical proof examines simple groups of order less than 60 and establishes that the smallest non-cyclic simple group has order 60. It uses group theory concepts including normal subgroups, group actions, and the Sylow theorems.

### Source excerpt

Preamble: This proof is not particularly elegant or insightful. However, it belongs in this gallery for two reasons. First, it is an example of the goal of most mathematics: to classify things. In the same way that all natural numbers can be built up from primes, every group can be built up from simple groups. So if we want to understand all groups, it suffices to understand the simple ones. Indeed, this project has been the collective goal of hundreds of mathematicians for the past hundred years, culminating in one awesomely gargantuan theorem: The Classification of Finite Simple Groups.

## Number Theory--A Primer

DevFeed: [Number Theory--A Primer](<https://devfeed.tech/articles/number-theory-a-primer-40235.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2011/07/30/number-theory-a-primer/>)

Published: 2011-07-30T15:03:38Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [primes](<https://devfeed.tech/topics/primes.md>), [Cryptography](<https://devfeed.tech/topics/cryptography.md>), [Encryption](<https://devfeed.tech/topics/encryption.md>)

Tags: [arithmetic](<https://devfeed.tech/tags/arithmetic.md>), [encryption](<https://devfeed.tech/tags/encryption.md>), [factoring](<https://devfeed.tech/tags/factoring.md>), [gcd](<https://devfeed.tech/tags/gcd.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [number](<https://devfeed.tech/tags/number.md>), [number-theory](<https://devfeed.tech/tags/number-theory.md>), [primer](<https://devfeed.tech/tags/primer.md>), [primes](<https://devfeed.tech/tags/primes.md>), [programming](<https://devfeed.tech/tags/programming.md>), [rsa](<https://devfeed.tech/tags/rsa.md>)

### AI overview

A primer on elementary number theory covering integers, divisibility, composite and prime numbers, prime factorization, and the greatest common divisor. It provides background for a separate post on RSA encryption.

### Source excerpt

This primer exists for the background necessary to read our post on RSA encryption, but it also serves as a general primer to number theory. Oh, Numbers, Numbers, Numbers We start with some easy definitions. Definition: The set of integers, denoted $ \mathbb{Z}$, is the set $ \left \{ \dots -2, -1, 0, 1, 2, \dots \right \}$. Definition: Let $ a,b$ be integers, then $ a$ divides $ b$, denoted $ a \mid b$, if there exists an integer $ n$ such that $ na = b$.

## Encryption & RSA

DevFeed: [Encryption & RSA](<https://devfeed.tech/articles/encryption-rsa-40234.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2011/07/29/encryption-rsa/>)

Published: 2011-07-29T23:55:57Z

Content type: article

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Encryption](<https://devfeed.tech/topics/encryption.md>), [Cryptography](<https://devfeed.tech/topics/cryptography.md>), [Mathematics](<https://devfeed.tech/topics/mathematics.md>)

Tags: [computing](<https://devfeed.tech/tags/computing.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [encryption](<https://devfeed.tech/tags/encryption.md>), [java](<https://devfeed.tech/tags/java.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [primes](<https://devfeed.tech/tags/primes.md>), [programming](<https://devfeed.tech/tags/programming.md>), [rsa](<https://devfeed.tech/tags/rsa.md>)

### AI overview

This article introduces cryptography as an application of number theory and begins explaining the historical shift from shared-secret encryption to public-key methods, including RSA.

### Source excerpt

This post assumes working knowledge of elementary number theory. Luckily for the non-mathematicians, we cover all required knowledge and notation in our number theory primer. So Three Thousand Years of Number Theory Wasn't Pointless It's often tough to come up with concrete applications of pure mathematics. In fact, before computers came along mathematics was used mostly for navigation, astronomy, and war. In the real world it almost always coincided with the physical sciences.

## Prime Design

DevFeed: [Prime Design](<https://devfeed.tech/articles/prime-design-40200.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2011/06/13/prime-design/>)

Published: 2011-06-13T14:26:39Z

Content type: article

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Mathematics](<https://devfeed.tech/topics/mathematics.md>), [Graphics](<https://devfeed.tech/topics/graphics.md>), [CSS](<https://devfeed.tech/topics/css.md>), [web design](<https://devfeed.tech/topics/web-design.md>)

Tags: [bash](<https://devfeed.tech/tags/bash.md>), [css](<https://devfeed.tech/tags/css.md>), [design](<https://devfeed.tech/tags/design.md>), [graphics](<https://devfeed.tech/tags/graphics.md>), [html](<https://devfeed.tech/tags/html.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [primes](<https://devfeed.tech/tags/primes.md>), [programming](<https://devfeed.tech/tags/programming.md>), [theory](<https://devfeed.tech/tags/theory.md>)

### AI overview

This post explores using prime numbers to create interesting, asymmetric graphics with CSS. It introduces number patterns, proves the geometric-series identity using base representations, and discusses basic properties and conjectures about prime numbers.

### Source excerpt

The goal of this post is to use prime numbers to make interesting and asymmetric graphics, and to do so in the context of the web design language CSS. Number Patterns For the longest time numbers have fascinated mathematicians and laymen alike. Patterns in numbers are decidedly simple to recognize, and the proofs of these patterns range from trivially elegant to Fields Medal worthy. Here's an example of a simple one that computer science geeks will love: