English

Algorithms to Uniformly Generate Random Factored Smooth Integers

Number Theory 2026-01-15 v2

Abstract

Let xy>0x\ge y>0 be integers. A positive integer is yy-smooth if all its prime divisors are at most yy. Let Ψ(x,y)\Psi(x,y) count the number of yy-smooth integers up to xx. We present several algorithms that will generate an integer nxn\le x at random, with known prime factorization, such that nn is yy-smooth. We begin by describing algorithms to compute Ψ(x,y)\Psi(x,y) exactly and to enumerate yy-smooth integers up to xx 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 rr, 0r<10\le r<1, and returns the integer nn that is at position rΨ(x,y)\lfloor r\Psi(x,y)\rfloor in the lexicographic ordering of all yy-smooth integers up to xx. Here position 0 is the first position. Thus, nn is generated uniformly so long as rr is chosen uniformly. This algorithm has a running time of O(Ψ(x,y)loglogy)O(\Psi(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((logx)3loglogx) O\left( \frac{ (\log x)^3 }{\log\log x} \right) arithmetic operations. We conclude with a sample run by generating a 1000010000-smooth integer 10100\le 10^{100}.

Cite

@article{arxiv.2006.07445,
  title  = {Algorithms to Uniformly Generate Random Factored Smooth Integers},
  author = {Eric Bach and Jonathan Sorenson},
  journal= {arXiv preprint arXiv:2006.07445},
  year   = {2026}
}
R2 v1 2026-06-23T16:17:24.544Z