AI & Computingarticle2026-12-01

Algorithms to generate random factored smooth integers

Open access3 citations

Abstract

Let $$x\ge y>0$$ x ≥ y > 0 be integers. A positive integer is y -smooth if all its prime divisors are at most y. Let $$\Psi (x,y)$$ Ψ (x, y) count the number of y -smooth integers up to x. We present several algorithms that will generate an integer $$n\le x$$ n ≤ x at random, with known prime factorization, such that n is y -smooth. We begin by describing algorithms to compute $$\Psi (x,y)$$ Ψ (x, y) exactly and to enumerate y -smooth integers up to x in lexicographic order by prime divisor. Both of these are based on Buchstab’s identity, and were likely known before. Then we present an algorithm that accepts as input a parameter r, $$0\le r<1$$ 0 ≤ r < 1, and returns the integer n that is at position $$\lfloor r\Psi (x,y)\rfloor $$ ⌊ r Ψ (x, y) ⌋ in the lexicographic ordering of all y -smooth integers up to x. Here position 0 is the first position. Thus, n is generated uniformly so long as r is chosen uniformly. This algorithm has a running time of $$O(\Psi (x,y)\log \log y)$$ O (Ψ (x, y) log log y) arithmetic operations. We then explore the tradeoff between speed and rigor. By relaxing the uniformity of the output and allowing for multiple heuristics in our runtime analysis, we improve the running time to $$O\left( \frac{ (\log x)^3 }{\log \log x} \right) $$ O (log x) 3 log log x arithmetic operations. We conclude with a sample run by generating a 10, 000-smooth integer $$\le 10^{100}$$ ≤ 10 100.

// Source

View paper (DOI)Open access versionOpenAlexResearch in Number TheoryPublished 2026-12-01

Authors: Eric Bach, Jonathan Sorenson

Institutions: University of Wisconsin–Madison, Butler University