We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd4da54 commit 3457408Copy full SHA for 3457408
src/Primes.jl
@@ -272,6 +272,13 @@ Base.isempty(f::FactorIterator) = f.n == 1
272
# https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
273
# http://maths-people.anu.edu.au/~brent/pub/pub051.html
274
#
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
282
eachfactor(n::Integer) = FactorIterator(n)
283
284
# state[1] is the current number to factor (this decreases when factors are found)
0 commit comments