@@ -133,7 +133,7 @@ function _generate_min_factors(limit)
133
133
function min_factor (n)
134
134
n < 4 && return n
135
135
for i in 3 : 2 : isqrt (n)
136
- n% i == 0 && return i
136
+ n% i == 0 && return i
137
137
end
138
138
return n
139
139
end
@@ -156,14 +156,14 @@ end
156
156
"""
157
157
isprime(n::Integer) -> Bool
158
158
159
- Returns for values in the range of an INT64 variable: `true` if `n` is prime, and `false` otherwise
160
- for bigger values: `true` if `n` is probably prime, and `false` otherwise (false-positive rate = 0.25^reps with reps=25 --> considerered safe)
159
+ Returns for values in the range of an INT64 variable: `true` if `n` is prime, and `false` otherwise
160
+ for bigger values: `true` if `n` is probably prime, and `false` otherwise (false-positive rate = 0.25^reps with reps=25 --> considered safe)
161
161
162
162
More detailed:
163
163
for even numbers: returns deterministic and correct results
164
164
for values in the range of an INT64 variable: returns deterministic and correct results (by Lookup-tables, trial-division, Miller-Rabin, Lucas-Test)
165
- for bigger values: returns probabilistic resultsfrom GNU Multiple Precision Arithmetic Library
166
-
165
+ for bigger values: returns probabilistic resultsfrom GNU Multiple Precision Arithmetic Library
166
+
167
167
```julia
168
168
julia> isprime(3)
169
169
true
@@ -273,7 +273,7 @@ function lucas_test(n::T) where T<:Signed
273
273
if isodd (k>> b) == 1
274
274
Qk = mod (Qk* Q, n)
275
275
U, V = U + V, V + U* D
276
- # adding n makes them even
276
+ # adding n makes them even
277
277
# so we can divide by 2 without causing problems
278
278
isodd (U) && (U += n)
279
279
isodd (V) && (V += n)
@@ -328,9 +328,9 @@ Base.isempty(f::FactorIterator) = f.n == 1
328
328
#
329
329
330
330
"""
331
- eachfactor(n::Integer)->FactorIterator
331
+ eachfactor(n::Integer)->FactorIterator
332
332
Returns a lazy iterator of factors of `n` in `(factor, multiplicity)` pairs.
333
- This can be very useful for computing multiplicitive functions since for small numbers (eg numbers with no factor `>2^16`),
333
+ This can be very useful for computing multiplicative functions since for small numbers (e.g. numbers with no factor `>2^16`),
334
334
allocating the storage required for `factor(n)` can introduce significant overhead.
335
335
"""
336
336
eachfactor (n:: Integer ) = FactorIterator (n)
@@ -373,7 +373,7 @@ function iterate(f::FactorIterator{T}, state=(f.n, T(3))) where T
373
373
_min_factor (p) == p || continue
374
374
num_p = 0
375
375
while true
376
- q, r = divrem (n, T (p)) # T(p) so julia <1.9 uses fast divrem for `BigInt`
376
+ q, r = divrem (n, T (p)) # T(p) so julia <1.9 uses fast ` divrem` for `BigInt`
377
377
r == 0 || break
378
378
num_p += 1
379
379
n = q
0 commit comments