betaFeedback

WorksMathematics

Constructing Large Euler Pseudoprimes through Carmichael Products

Abstract

Inspired by recent work on Carmichael numbers and by the construction of Sanchez, et al., we revisit the subset product construction of Alford, et al. We state a theoretical parallel variant of the pushdown algorithm and extend computational records in two ways. First, we construct a Carmichael number that is an Euler pseudoprime to every base up to 11728191172819, which includes the first 9096890968 prime numbers. Second, we extend the known list of Carmichael numbers with exactly dd prime factors from d≤19565220d \leq 19565220 to d≤340210163d \leq 340210163.

Introduction

Carmichael numbers are composite numbers nn for which bn≡b(modn)b^n \equiv b \pmod{n} for all b∈Zb \in\mathbb{Z}. They are pseudoprimes, since they satisfy the conclusion of Fermat’s little theorem despite being composite.

These numbers have fascinated analytic number theorists and algorithmic number theorists alike, and the two groups have influenced each other in profound ways. In the introduction to Alford, Granville, and Pomerance’s proof of the infinitude of Carmichael numbers [3], their footnote credits the computational success of the subset-product problem as inspiring their own approach. In the other direction, [11, 10]’s arguments for the asymptotic count of Carmichael numbers provided the framework for Shallue & Webster’s proof of a heuristically optimal tabulation algorithm [12 Theorem 3]. We continue that tradition here, influenced by two recent results on Carmichael numbers.

Carmichael numbers as Euler pseudoprimes

Since Carmichael numbers are Fermat pseudoprimes, it has been common to see if they also satisfy the pseudoprimality of other, stronger tests based on Fermat’s little theorem. One example is the Solovay-Strassen test, which given a candidate prime nn and a base bb with gcd⁡(b,n)=1\gcd(b,n)=1 checks to see if

(bn)≡bn−12(modn)\left(\frac{b}{n}\right) \equiv b^{\frac{n-1}{2}} \pmod{n}

and reports that nn is proven composite if the identity fails. The composite nn that pass the test are called Euler pseudoprimes to the base bb.

In [1] the authors present a novel construction. This involves finding a product of Carmichael numbers that forms an Euler pseudoprime to all integer bases bb up to 211, i.e. it fools the Solovay-Strassen test for the smallest 47 prime bases. Boltnev [5] previously constructed a strong (and thus Euler) pseudoprime to the first 350 prime bases, through 2357. His example also passes the next two prime bases, so it covers all prime bases up to 2377. We present a new construction which greatly improves upon this result; we have found a product of Carmichael numbers that forms an Euler pseudoprime to all integer bases bb up to 1172819.

Carmichael numbers with prime factors

It had long been conjectured that for every d>2d > 2, there exists a Carmichael number with exactly dd prime factors. Larsen and Wright recently proved an asymptotic version of this result showing that for all dd sufficiently large, there exists a Carmichael number with exactly dd prime factors [8]. In private correspondence, Larsen indicated that it might be possible to make the bound effective and guessed that doing so would result in dd on the order of 10100010^{1000}. This is significantly beyond our ability to bridge the known counts of 19565220 from [2]. Nonetheless, we revisited this computation and extended this result to 340210163, a factor of 17 improvement.

Organization

The remainder of the paper is structured as follows. § 2 provides the necessary background on Carmichael numbers and pseudoprimes and provides a summary of the pseudoprime construction technique of [1]. § 3 reviews Algorithm 1 of [2] and explains how it may be run efficiently in a parallel computing environment. Section 4 explains the required modifications and additions to the subset product algorithm to find an Euler pseudoprime to many bases. § 5 provides some details of the implementation and of the computational results.

Background

We frequently recognize Carmichael numbers nn via their prime factorization.

Theorem 1 (Korselt’s Criterion). A composite number nn is a Carmichael number if and only if nn is square-free and (p−1)∣(n−1)(p - 1) \mid(n - 1) for all prime divisors pp of $n.

Robert Carmichael proved Korselt’s criterion in the context of the reduced totient function or the Carmichael function λ(n)\lambda(n),

λ(pα)={ϕ(pα)if α≤2 or p≥3,12ϕ(pα)if α≥3 and p=2.\lambda\left(p^\alpha\right) = \begin{cases} \phi\left(p^\alpha\right) & \text{if } \alpha\le2 \text{ or } p \ge3,\\ \frac{1}{2}\phi\left(p^\alpha\right) & \text{if } \alpha\ge3 \text{ and } p = 2. \end{cases}
λ(n)=λ(p1α1⋯pkαk)=lcm⁡(λ(p1α1),…,λ(pkαk)),\lambda(n) = \lambda\left(p_1^{\alpha_1}\cdots p_k^{\alpha_k}\right) = \operatorname{lcm}\left(\lambda\left(p_1^{\alpha_1}\right),\ldots,\lambda\left(p_k^{\alpha_k}\right)\right),

where the pip_i are distinct prime divisors of nn and ϕ(n)\phi(n) is Euler’s totient function. Later we will also refer to v2(n)v_2(n), the 2-adic valuation of nn, which returns the largest exponent ee such that 2e∣n2^e \mid n. We can now state Korselt’s criterion in terms of λ(n)\lambda(n).

Theorem 2 (Korselt’s Criterion). A composite number nn is a Carmichael number if and only if λ(n)∣(n−1)\lambda(n) \mid(n - 1).

Some early views on the infinitude of Carmichael numbers came from the fact that n=(6k+1)(12k+1)(18k+1)n = (6k + 1)(12k + 1)(18k + 1) is a Carmichael number if nn is a product of three primes. If the prime kk-tuples conjecture were true, then this family would produce infinitely many Carmichael numbers. However, the argument that won the day (often attributed to Erdős) is centered not around specific families of nn, but rather around numbers with some prescribed Carmichael Lambda value. Indeed, let

Λ=∏ipiei,\Lambda= \prod_i p_i^{e_i},

where pip_i are the ordered prime numbers and ei>0e_i > 0. Consider the set P={p prime:(p−1)∣Λ, p∤Λ}\mathcal{P} = \{p\text{ prime}: (p - 1) \mid\Lambda,\ p \nmid\Lambda\}. If 2∣P∣2^{|\mathcal{P}|} is large compared to ϕ(Λ)\phi(\Lambda), then it should be possible to find a subset product in P\mathcal{P} that is 1 (mod Λ\Lambda). The idea is that a subset product in P\mathcal{P} takes a random value in (Z/ΛZ)×(\mathbb{Z}/\Lambda\mathbb{Z})^\times and with enough such products it is likely that at least one such composite product will land on 1. Let NN be such a product. Then λ(N)∣Λ∣(N−1)\lambda(N) \mid\Lambda\mid(N - 1), and so it is a Carmichael number. It is possible to choose Λ\Lambda so that many pair-wise co-prime Carmichael numbers may be found as subset products in P\mathcal{P}, and this was the key strategy of [2], which we explain in § 3.

Constructing an Euler pseudoprime from Carmichael numbers

See [1] for a fuller treatment of this topic.

Definition 1 (Index). The index of a Carmichael number nn is given by

i(n)=n−1λ(n).i(n) = \frac{n - 1}{\lambda(n)} .

In [1], a coarse classification of Carmichael numbers was constructed. We focus only on the class needed for this paper.

Definition 2 (Class A Carmichael numbers). A Carmichael number nn is considered to be in Class A if i(n)i(n) is even.

Lemma 1 ([1], Lemma 7). Let nn be a Carmichael number in Class A. Then there are 12ϕ(n)\frac{1}{2}\phi(n) Euler liars in Zn×\mathbb{Z}_n^\times and all have Jacobi symbol 1.

The Class A Carmichael numbers make good candidates for Euler pseudoprimes. We need a Lemma regarding the product of two Class A Carmichael numbers.

Lemma 2 ([1], Lemma 12). Let n1n_1 and n2n_2 with gcd⁡(n1,n2)=1\gcd(n_1,n_2) = 1 be Class A Carmichael numbers. If n=n1n2n = n_1n_2 is a Carmichael number, then nn is in Class A if min⁡{v2(n1−1),v2(n2−1)}>max⁡{v2(λ(n1)),v2(λ(n2))}\min\{v_2(n_1 - 1), v_2(n_2 - 1)\} > \max\{v_2(\lambda(n_1)), v_2(\lambda(n_2))\}.

So, these two lemmas allow us to multiply Class A Carmichael numbers and retain their classification and Euler pseudoprimality properties.

Lemma 3 ([1], Lemma 13). Let n1n_1 and n2n_2 be Class A Carmichael numbers that are Euler pseudoprimes for every base less than the prime bb and not to bb itself. Assume gcd⁡(n1,b)=gcd⁡(n2,b)=1\gcd(n_1,b) = \gcd(n_2,b) = 1. Then if n=n1n2n = n_1n_2 is a Class A Carmichael number, it is an Euler pseudoprime for all bases up to and including bb.

Proof. Assume n1n_1 and n2n_2 are in Class A, which means that the multiplicative order of aa modulo nin_i for all a<ba < b is a divisor of (ni−1)/2(n_i - 1)/2. Thus the Jacobi symbol is 1, and so the Jacobi symbol for the product n1n2n_1n_2 is also 1 for all bases less than bb. This makes the product also an Euler pseudoprime to all bases less than bb.

Now focusing on bb, the Jacobi symbol with bb is −1-1. By multiplying two such numbers, the Jacobi symbol becomes 1, and the product being Class A means that the power is also 1. This makes the product an Euler pseudoprime to the base bb as well. □

The above is sufficient to describe their method and we refer the readers to Sections 3–5 of [1] for their complete description. They used the table of Carmichael numbers produced by [12] to construct products that were again Carmichael numbers. They repeatedly invoked Lemma 3 in order to construct Euler pseudoprimes to consecutive prime bases. At each stage of their algorithm, they were able to account for one more prime base.

The practical difficulty in their construction is the antecedent “if n=n1n2n=n_1n_2 is a Carmichael number.” This is unlikely to hold. Our solution, alluded to above, is to use the subset product construction to guarantee the antecedent is always satisfied.

Lemma 4. Let Λ\Lambda be a positive integer. Assume that n1n_1 and n2n_2 are Carmichael numbers with gcd⁡(n1,n2)=1\gcd(n_1,n_2)=1. Further assume

(p−1)∣Λ∣(n1−1) ∀ p∣n1and(p−1)∣Λ∣(n2−1) ∀ p∣n2.(p-1)\mid\Lambda\mid(n_1-1)\ \forall\ p\mid n_1\quad\text{and}\quad(p-1)\mid\Lambda\mid(n_2-1)\ \forall\ p\mid n_2.

Then n1⋅n2n_1\cdot n_2 is also Carmichael.

Proof. Since gcd⁡(n1,n2)=1\gcd(n_1,n_2)=1 and both are Carmichael numbers, their product is squarefree. Since n1≡1(modΛ)n_1\equiv1\pmod{\Lambda} and n2≡1(modΛ)n_2\equiv1\pmod{\Lambda}, their product is also equivalent to 1 modulo Λ\Lambda. The divisibility assumption of the Korselt criterion is then satisfied by the divisibility assumption of the lemma. □\square

In the next section we will see that the result of Algorithm 1 naturally leads to the conditions of Lemma 4 being satisfied, and hence our Carmichael products will always themselves be Carmichael.

The only minor adjustment, to be explained below, is to guarantee the inequality on the 2-valuations in Lemma 2 is always satisfied. Having done that, we will show that all of the Jacobi symbols may be aligned at once rather than one at a time. For our purposes, a simpler version of Lemma 3 suffices, which we state without proof.

Lemma 5. Let n1n_1 and n2n_2 be Class A Carmichael numbers that are not base bb Euler pseudoprimes. Assume gcd⁡(n1,b)=gcd⁡(n2,b)=1\gcd(n_1,b)=\gcd(n_2,b)=1. Then if n=n1n2n=n_1n_2 is a Class A Carmichael number, it is a base bb Euler pseudoprime.

The Subset Product Algorithm

We present a slight modification to the modular subset product algorithm of [2] suitable for a parallel computing environment. As set up, we choose some

Λ=∏i=1rpiei,\Lambda=\prod_{i=1}^{r}p_i^{e_i},

where pip_i are the ordered prime numbers and ei>0e_i>0. We let Qi=pieiQ_i=p_i^{e_i}; in particular Q1Q_1 is some power of 2. We construct the set P={p prime:(p−1)∣Λ, p∤Λ}\mathcal{P}=\{p\text{ prime}:(p-1)\mid\Lambda,\ p\nmid\Lambda\}, then find many disjoint subsets of P\mathcal{P} that product to 1 modulo Λ\Lambda. Each such composite product is a Carmichael number.

Asymptotic Complexity

There is a rich literature on the modular subset product problem, only some of which we will review here. We start with the observation that the problem is NP-complete [7]. Despite this fact, there are many instances where a polynomial time algorithm exists. Understanding which instances are easy and which are hard requires the notion of density.

Definition 3. Let {x1,x2,…,xn,b,M}\{x_1,x_2,\ldots,x_n,b,M\} define a modular subset product problem, where our goal is to find a subset of the xix_i that products to bb modulo MM. The density of the problem is defined as nlog⁡ϕ(M)\frac{n}{\log\phi(M)}, where log⁡\log is the base-2 logarithm.

In a rough sense, the density compares the count of subsets with the size of the group. For a random instance of the problem, a solution exists with high probability if and only if the density is greater than one. If the density is less than one and we are confident that a solution exists, a good strategy is to use lattice basis reduction [6]. If the density is one (the hardest instances), one could use a birthday-problem approach that costs O~(2n/2)\widetilde{O}(2^{n/2}) time and space, or an improved version like [4] with running time O~(20.291n)\widetilde{O}(2^{0.291n}) for additive subset sum.

When constructing Carmichael numbers it is easy to generate instances with density much greater than one, so we will now focus on that case. The classic solution is dynamic programming: build a 2D table and fill it in at a cost of O(n⋅M)O(n \cdot M) time and space. In our case MM is large enough that this solution becomes impractical, so we turn instead to the method of [9], which was improved in [2]. See the next subsection for the presentation and discussion of that algorithm.

Algorithm

In our construction of an Euler pseudoprime to many bases we needed to construct many Carmichael numbers, all with respect to the same Λ\Lambda and the same set P\mathcal{P}. For this purpose we used [2 Algorithm 1].

We call this the “pushdown algorithm,” because at each step pairs of products are found which are multiplicative inverses modulo the next QuQ_u, pushing the new product down to a smaller subgroup of (Z/ΛZ)×(\mathbb{Z}/\Lambda\mathbb{Z})^{\times}. By repeating the pushdown step for each of the prime powers QuQ_u dividing Λ\Lambda, the algorithm ends with a collection of disjoint products, all of which are the identity modulo Λ\Lambda, and hence each composite product is a Carmichael number.

The algorithm requires high density in order to succeed. Furthermore, choosing a Λ\Lambda with higher density results in more Carmichael numbers constructed.

Lines 4–12 and 23–25 are optionally included (or excluded) all at once. Not executing the optional lines decreases the number of elements that would have been in SuS_u by at most 1 per round for a given Su−1S_{u-1}. Since the goal is to have many Carmichael numbers, we assume the optional lines are executed, and this is how the original Algorithm 1 of [2] worked. We address the significance of these optional lines in Subsection 3.3.

We note that lines 13–22 can be accomplished with a bucket-style sort using at most ϕ(Qu)/2+1\phi(Q_u)/2 + 1 buckets. Each bucket is jointly used by aa or a^\hat{a} and can only have one or the other element (if both are found, it is a match and removed).

An important implementation detail is that group elements aa are stored as a list of integers which are elements of P\mathcal{P} (called the history), along with their product as an element of (Z/ΛZ)×(\mathbb{Z}/\Lambda\mathbb{Z})^{\times}. In this way we can reconstruct the Carmichael number as an integer, while being able to calculate the needed residues in a constant number of group operations.

Theorem 3. Algorithm 1 has time complexity O(rn)O(rn), measured in operations in the group (Z/ΛZ)×(\mathbb{Z}/\Lambda\mathbb{Z})^{\times}. Here rr is the number of distinct primes dividing Λ\Lambda and n=∣P∣n = |\mathcal{P}|.

Proof. The algorithm has a nested loop structure, where the outer loop has length rr and the inner loop has length ∣Su−1∣≤∣S0∣=n|S_{u-1}| \le|S_0| = n.

For a given uu, processing via the bucket-style sort requires one pass at a cost of O(∣Su−1∣)O(|S_{u-1}|) group operations, since for each aa we either pass it along, put it in a bucket, or pair it with an element in a bucket and pass the pair along.

Algorithm 1 Many Carmichael numbers

  1. S0←PS_0 \leftarrow\mathcal{P}

  2. for u←1u \leftarrow1 to rr do

    1. Su←∅S_u \leftarrow\varnothing

    2. (Optional) fixable ←\leftarrow true

    3. (Optional) Calculate bu=∏a∈Su−1a(modQu)b_u = \prod_{a\in S_{u-1}} a \pmod{Q_u}

    4. if (Optional) bu≠1b_u \ne1 then

      1. if there exists a∈Su−1a \in S_{u-1} with a≡bu(modQu)a \equiv b_u \pmod{Q_u} then

        1. Remove exactly one such aa from Su−1S_{u-1}

      2. else

        1. fixable ←\leftarrow false

      3. end if

    5. end if

    6. for a∈Su−1a \in S_{u-1} do

      1. if a≡1(modQu)a \equiv1 \pmod{Q_u} then

        1. Su←Su∪{a}S_u \leftarrow S_u \cup\{a\} and remove aa from Su−1S_{u-1}

      2. else

        1. Find a^∈Su−1∖{a}\hat{a} \in S_{u-1} \setminus\{a\} such that aa^≡1(modQu)a\hat{a} \equiv1 \pmod{Q_u}, if one exists

        2. if such an a^\hat{a} exists then

          1. Su←Su∪{aa^}S_u \leftarrow S_u \cup\{a\hat{a}\}, and remove a,a^a,\hat{a} from Su−1S_{u-1}

        3. end if

      3. end if

    7. end for

    8. if (Optional) fixable and Su−1≠∅S_{u-1} \ne\varnothing then

      1. (Optional) Multiply the remaining a∈Su−1a \in S_{u-1}, add to SuS_u

    9. end if

  3. end for

  4. return SrS_r, each composite element of which is Carmichael

Heuristic 4. Assume the elements of P\mathcal{P} are uniformly distributed elements of (Z/ΛZ)×(\mathbb{Z}/\Lambda\mathbb{Z})^\times. Then Algorithm 1 has expected time complexity O(∣P∣)O(|\mathcal{P}|), measured in group operations.

Heuristic justification. The total number of aa considered by the algorithm is

∣S0∣+∣S1∣+⋯+∣Sr−1∣.|S_0| + |S_1| + \cdots+ |S_{r-1}|.

At each step in the outer loop, an expected fraction 1ϕ(Qu)\frac{1}{\phi(Q_u)} of the elements will be passed to the next stage immediately. Of the remaining, we expect them to pair up and for their product to be passed along. Thus we have the expectation that

∣Su∣≤∣Su−1∣ϕ(Qu)+12(∣Su−1∣−∣Su−1∣ϕ(Qu))≤∣Su−1∣(12ϕ(Qu)+12)≤23∣Su−1∣.|S_u| \le\frac{|S_{u-1}|}{\phi(Q_u)} + \frac{1}{2}\left(|S_{u-1}|-\frac{|S_{u-1}|}{\phi(Q_u)}\right) \le|S_{u-1}|\left(\frac{1}{2\phi(Q_u)}+\frac{1}{2}\right) \le\frac{2}{3}|S_{u-1}|.

where the last inequality follows as long as ϕ(Qu)≥3\phi(Q_u) \ge3. (At most two rounds fail that inequality, and they do not affect the overall bound.) We conclude that the total number of aa is O(∣S0∣)=O(∣P∣)O(|S_0|)=O(|\mathcal{P}|) by bounding the resulting geometric sum.

At step uu we scan through the set of elements, either placing an element in one of the ϕ(Qu)/2+1\phi(Q_u)/2+1 buckets or matching with an element in a bucket and removing both. Since we have access to the residue modulo Λ\Lambda, processing each element results in a constant number of group operations. □

Note that counting bit operations rather than group operations would make Theorem 3 a more accurate picture compared to Heuristic 4, as effectively the entirety of S0S_0 is carried along from step to step via the history portion of the element representation.

These bounds make no claims as to the density required to ensure that SrS_r is nonempty with high probability; in practice we found it easy to construct Λ\Lambda with high enough density.

A parallel version of Algorithm 1

We describe two versions of a theoretical distributed-memory implementation of Algorithm 1. The key distinction is found in the inclusion or exclusion of the optional lines. The first, where we exclude the optional lines, is more elementary and provides a simple chunking structure. This version may actually be run sequentially if it is not feasible to have all of P\mathcal{P} stored at once. It also uses no inter-process communication and may be preferred if inter-process communication is especially costly. The second version shows how to introduce inter-process communication and allow the execution of the optional lines.

Model. We assume kk processes with ranks 0,…,k−10,\ldots,k-1, each with private memory, and point-to-point and tree-structured collective communication.

Parallel prime generation. The ability to generate primes in parallel was addressed in [2]. One simple method to accomplish this is by assigning certain fixed divisors of Λ\Lambda to given processors. In this way, we can create

P=⋃j=0k−1S0(j),\mathcal{P} = \bigcup_{j=0}^{k-1} S_0^{(j)},

where the union is a disjoint union and processor jj has S0(j)S_0^{(j)}. With the exception of the assignment of the fixed divisors for initialization, prime generation needs no communication among the kk processors.

Trivial parallelization. Processor jj simply runs Algorithm 1, where line 1 has the assignment S0←S0(j)S_0 \leftarrow S_0^{(j)}. After each of kk processors finish their work, the elements in Sr(j)S_r^{(j)} can be pooled together. The success of Algorithm 1 relies on having a sufficiently dense set of solutions to the subset product problem. This places a practical limit on the number of processors that can be used in this trivial parallelization before the expectation is that each local job would fail to find Carmichael numbers. Conservatively, each process might need

∣S0(j)∣≳max⁡1≤u≤r2u−1Qu2,\left|S_0^{(j)}\right| \gtrsim\max_{1\leq u\leq r} 2^{u-1}Q_u^2,

primes so that the final step is expected to be nonempty. We can use static partitioning by choosing

k≈∣P∣max⁡1≤u≤r2u−1Qu2.k \approx\frac{|\mathcal{P}|}{\max_{1\leq u\leq r} 2^{u-1}Q_u^2}.

Heuristic estimates of ∣P∣|\mathcal{P}| are good once Λ\Lambda is fixed, so kk can be chosen before the computation begins.

Parallel version with communication. We explain how to accomplish Algorithm 1 in parallel while executing the optional lines. The guiding principle is that the elements of SuS_u grow as uu increases, but the information needed to decide which elements to combine is small (residues modulo QuQ_u). The algorithm therefore favors local work, communicates residues modulo QuQ_u freely, and communicates the elements aa or a^\hat{a} as rarely as possible. It does not matter if aa is treated as an actual integer formed as a product of primes or as a data structure that stores the prime factors explicitly. In either case, the asymptotic cost of communication remains the same.

We describe round uu of Algorithm 1 in a parallel environment. As with the trivial parallelization, line 1 is replaced with S0←S0(j)S_0 \gets S_0^{(j)}. And rank jj only has access to Su−1(j)S_{u-1}^{(j)} unless the instructions indicate communication.

  1. Line 5 is computed by an all-reduce of the residues.

  2. For lines 6–12, when bu≠1b_u \ne1, each process reports whether it holds an element congruent to bu(modQu)b_u \pmod{Q_u} and the lowest such rank, found with an all-reduce, deletes one such element. If none exist, set fixable to false.

  3. Lines 13–22 are first accomplished locally. Unmatched elements are saved for parallel matching.

  4. The remaining matches are found by a binary tree reduction over the residue tables.

    • Pairs of processors share their residue tables which contain the rank and surplus residues. When a match is found, only aa or a^\hat{a} are communicated as necessary.

    • The pairs produce a joint residue and rank table, which is used in the node above.

  5. For lines 23–25, if fixable is true and the global leftover pool is nonempty, once the root’s table has no more matches, each process multiplies its own unmatched elements. These kk partial products are combined in a tree product into one last element of SuS_u, which may be assigned to any processor.

The intent is to write this parallel code using a static partitioning of the work. Keeping in mind that most work is meant to be done locally, it is possible to redesign the above to allow dynamic partitioning. If Su(j)S_u^{(j)} drops below some threshold, processor jj can send all of its products in the first step of the tree reduction.

Euler Pseudoprimes to many bases — Linear Algebra over F2\mathbb{F}_2

It is simple to modify the above to create Class A Carmichael numbers whose products are also always in Class A. We need the inequality on the 2-valuations of Lemma 2 to be satisfied. There are two conceptually equivalent ways to accomplish this. First, we can run the prime generation phase on Λ/2\Lambda/2. Carmichael numbers produced this way satisfy λ(n)∣(Λ/2)∣Λ∣(n−1)\lambda(n) \mid(\Lambda/2) \mid\Lambda\mid(n-1). Second, we can replace Q1Q_1 (the power of 2) with 2Q12Q_1 when we run Algorithm 1. Numbers produced in this way satisfy λ(n)∣2Λ∣2Λ∣(n−1)\lambda(n) \mid2\Lambda\mid2\Lambda\mid(n-1). We either artificially lower the power of 2 for the prime generation phase or we artificially inflate the power of 2 for the subset product problem. In either case, v2(n−1)>v2(λ(n))v_2(n-1) > v_2(\lambda(n)), and for the remainder of the section we assume one of these two approaches has been taken.

Consider a set B\mathcal{B} of bases and let bkb_k denote the kk-th element of B\mathcal{B}. The easiest case to consider (and the case we computed) involves consecutive primes starting with 2, but in principle B\mathcal{B} could be any set of positive integers. For Lemma 5 to apply we need gcd⁡(n,b)=1\gcd(n,b)=1 for all n∈Srn \in S_r and all b∈Bb \in\mathcal{B}. In our computation we achieved this by restricting the primes in P\mathcal{P} before running the pushdown algorithm to ensure all were greater than the largest element of B\mathcal{B}.

By Lemma 1, we know half of all coprime bases are Euler liars (and thus have symbol 1). For each ni∈Srn_i \in S_r associate to it a vector bi\mathbf{b}_i over F2\mathbb{F}_2 in the following way. Let the coordinate in the kk-th place of bi\mathbf{b}_i have the value 0 if bkb_k is an Euler liar for nin_i and 1 otherwise (that is, the Jacobi symbol would be −1-1). So long as ∣Sr∣>∣B∣|S_r| > |\mathcal{B}|, we can use linear algebra over F2\mathbb{F}_2 to find a nontrivial solution x\mathbf{x} to

[b1 b2 ⋯ b∣Sr∣] x=0.[\mathbf{b}_1\ \mathbf{b}_2\ \cdots\ \mathbf{b}_{|S_r|}]\,\mathbf{x} = \mathbf{0}.

The solution corresponds to a disjoint product of Carmichael numbers in SrS_r which is an Euler pseudoprime to every bk∈Bb_k \in\mathcal{B}. This product is itself Carmichael by Lemma 4.

Implementation Details

The code for this paper and the factors of the Euler pseudoprime are available at https://github.com/31and8191/euler-carmichael-computations.

Euler pseudoprime computation

Let

Λ=28⋅35⋅53⋅72⋅112⋅132∏17≤p≤73p=10567690344536672406900888090467424000.\begin{aligned} \Lambda= 2^{8} \cdot3^{5} \cdot5^{3} \cdot7^{2} \cdot11^{2} \cdot13^{2} \prod_{17 \le p \le73} p \\ &= 10567690344536672406900888090467424000. \end{aligned}

For d∣Λd \mid\Lambda, we look for primes p=d+1p=d+1. We require pp to be greater than 1.3 million, so that we do not have the Jacobi symbol equal to zero for any tested base. By using 2Q1=292Q_1 = 2^{9} for pushdown, we ensure the resulting Carmichael numbers are Class A. The computation found 19551404 primes which combined via pushdown to give 90943 Carmichael numbers. The prime generation took less than 4 minutes with 24 jobs, and the serial pushdown took less than 9 minutes.

We form the matrix described in the previous section whose columns correspond to Carmichael numbers and rows to prime bases not dividing Λ\Lambda. The matrix with 90943 columns and 90947 rows has a one-dimensional kernel. We used a Python implementation of Gaussian elimination over F2\mathbb{F}_2 to find a nonzero solution. Along with the 21 bases dividing Λ\Lambda, the resulting Carmichael number passes the Euler pseudoprime test for the first 90968 prime bases.

The solution vector corresponds to the product of 45413 of the Carmichael numbers, with a total of 8667018 prime factors. This number has 160558499 decimal digits. Constructing the final Carmichael number from the 90943 seed Carmichael numbers, including the matrix work, took approximately 11.5 hours.

We then used a separate program to verify that the factors are distinct, for each pp, (p−1)∣Λ(p-1) \mid\Lambda, and that the product nn has 2Λ∣(n−1)2\Lambda\mid(n-1). For each prime base up to 1172819, we computed the Legendre symbols (a/p)(a/p) and multiplied them to get the Jacobi symbol (a/n)(a/n). It was 1 for every tested base. Because nn is Class A, we get the Euler condition.

Carmichael numbers with prime factors

With a new implementation of Algorithm 1 of [2], we extended the computation in that paper to demonstrate the existence of Carmichael numbers with exactly dd prime factors for every 3≤d≤3402101633 \le d \le340210163.

We use

Λ=212⋅37⋅54⋅73⋅112⋅132⋅172∏19≤p≤83p\Lambda= 2^{12} \cdot3^{7} \cdot5^{4} \cdot7^{3} \cdot11^{2} \cdot13^{2} \cdot17^{2} \prod_{19 \le p \le83} p

We obtain 340210290 primes which we combine via pushdown into 1529840 base Carmichael numbers. We compute the possible numbers of prime factors of products of these Carmichael numbers and see that there are Carmichael numbers with dd factors for all 32≤d≤34021016332 \le d \le340210163. Combined with the original result, this gives all 3≤d≤3402101633 \le d \le340210163.

The prime generation took about 1 hour and 42 minutes with 24 jobs, the pushdown took about 37 hours, and checking the base Carmichael numbers took about 7 minutes.

Conclusion

We are indebted to the authors of [1] for an inspiring paper. Among other reasons, this gave us a perfect excuse to revisit the pushdown algorithm, eventually parallelize it, and create a new codebase for it.

Note that we took the prime bases up to some bound for convenience, but the techniques can be applied to any chosen set of bases. It seems likely that similar techniques could be applied to the construction of other pseudoprimes.

AI Disclosure

The authors used Anthropic Claude Opus 4.8 to write code for this project. They used OpenAI Codex for subsequent code development and review, checking numerical details, and paper planning. The authors wrote the text of the paper, with editorial support provided by LLMs. The authors have checked the content of this paper and take responsibility for it.

References

(1) Institute for Defense Analyses/Center for Computing Sciences

(2) Illinois Wesleyan University

(3) Butler University

References

  1. [1]Alejandra Alcantarilla Sánchez, Jolijn Cottaar, Tanja Lange, and Benne de Weger, Ours go to 211: Euler pseudoprimes to 47 prime bases (from Carmichael numbers), 2026, arXiv:2602.21840.
  2. [2]W. R. Alford, Jon Grantham, Steven Hayman, and Andrew Shallue, Constructing Carmichael numbers through improved subset-product algorithms, Math. Comp. 83 (2014), no. 286, 899–915. MR 3143697arxiv.org/abs/1203.6664
  3. [3]W. R. Alford, Andrew Granville, and Carl Pomerance, There are infinitely many Carmichael numbers, Ann. of Math. (2) 139 (1994), no. 3, 703–722. MR 1283874 (95k:11114)DOI
  4. [4]Anja Becker, Jean-Sébastien Coron, and Antoine Joux, Improved generic algorithms for hard knapsacks, Advances in cryptology—EUROCRYPT 2011, Lecture Notes in Comput. Sci., vol. 6632, Springer, Heidelberg, 2011, pp. 364–385. MR 2813651
  5. [5]Yu. F. Boltnev, Construction of strong pseudoprime Carmichael numbers passing the Miller-Rabin test for many first prime bases, Prikl. Diskretn. Mat., Suppl. (2025), no. 18, 258–262 (Russian).
  6. [6]Matthijs J. Coster, Antoine Joux, Brian A. LaMacchia, Andrew M. Odlyzko, Claus-Peter Schnorr, and Jacques Stern, Improved low-density subset sum algorithms, Comput. Complex-ity 2 (1992), no. 2, 111–128. MR 1190825DOI
  7. [7]Richard M. Karp, Reducibility among combinatorial problems, Complexity of computer computations (Proc. Sympos., IBM Thomas J. Watson Res. Center, Yorktown Heights, N.Y., 1972), The IBM Research Symposia Series, Plenum, New York-London, 1972, pp. 85–103. MR 378476
  8. [8]Daniel Larsen and Thomas Wright, Carmichael numbers with a specified number of prime factors, Integers 26A (2026), A15, 14 pp.
  9. [9]Günter Löh and Wolfgang Niebuhr, A new algorithm for constructing large Carmichael numbers, Math. Comp. 65 (1996), no. 214, 823–836. MR 1325872
  10. [10]Carl Pomerance, On the distribution of pseudoprimes, Math. Comp. 37 (1981), no. 156, 587–593. MR 628717DOI
  11. [11]Carl Pomerance, J. L. Selfridge, and Samuel S. Wagstaff, Jr., The pseudoprimes to 25 · 10^9, Math. Comp. 35 (1980), no. 151, 1003–1026. MR 572872 (82g:10030)
  12. [12]Andrew Shallue and Jonathan Webster, Algorithms for Carmichael numbers, Proceedings of the Seventeenth Algorithmic Number Theory Symposium (ANTS XVII), 2026, To appear; https://arxiv.org/abs/2506.09903v3.

Paper details

vlnc:W_pazpdqpq
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

Claude Opus 4.8 (bare), Codex, LLMs

View statement
Looking for related papers…
Contents