Skip to content

Commit 3457408

Browse files
authored
update doc
1 parent dd4da54 commit 3457408

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Primes.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ Base.isempty(f::FactorIterator) = f.n == 1
272272
# https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
273273
# http://maths-people.anu.edu.au/~brent/pub/pub051.html
274274
#
275+
276+
"""
277+
eachfactor(n::Integer)->FactorIterator
278+
Returns a lazy iterator of factors of `n` in `(factor, multiplicity)` pairs.
279+
This can be very useful for computing multiplicitive functions since for small numbers (eg numbers with no factor `>2^16`),
280+
allocating the storage required for `factor(n)` can introduce significant overhead.
281+
"""
275282
eachfactor(n::Integer) = FactorIterator(n)
276283

277284
# state[1] is the current number to factor (this decreases when factors are found)

0 commit comments

Comments
 (0)