Skip to content

Commit 23df5b3

Browse files
authored
docs: fix typos and improve formatting (#158)
1 parent 2fd2f7b commit 23df5b3

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
[![Build Status](https://github.com/JuliaMath/Primes.jl/workflows/CI/badge.svg)](https://github.com/JuliaMath/Primes.jl/actions?query=workflow%3A%22CI%22+branch%3Amaster)
44
[![codecov](https://codecov.io/gh/JuliaMath/Primes.jl/graph/badge.svg?token=DI1wpcH9tB)](https://codecov.io/gh/JuliaMath/Primes.jl)
55

6-
76
Documentation:
8-
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaMath.github.io/Primes.jl/stable)
9-
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaMath.github.io/Primes.jl/latest)
7+
8+
[![docs stable badge](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaMath.github.io/Primes.jl/stable)
9+
[![docs latest badge](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaMath.github.io/Primes.jl/latest)
1010

1111
Julia functions for computing prime numbers.

docs/src/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ This package provides functions for computing prime numbers in Julia.
77
This release is available for Julia versions 1.6 and up.
88

99
To install it, run
10+
1011
```julia
1112
using Pkg ; Pkg.add("Primes")
1213
```
14+
1315
from the Julia REPL.

src/Primes.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function _generate_min_factors(limit)
133133
function min_factor(n)
134134
n < 4 && return n
135135
for i in 3:2:isqrt(n)
136-
n%i == 0 && return i
136+
n%i == 0 && return i
137137
end
138138
return n
139139
end
@@ -156,14 +156,14 @@ end
156156
"""
157157
isprime(n::Integer) -> Bool
158158
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)
161161
162162
More detailed:
163163
for even numbers: returns deterministic and correct results
164164
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+
167167
```julia
168168
julia> isprime(3)
169169
true
@@ -273,7 +273,7 @@ function lucas_test(n::T) where T<:Signed
273273
if isodd(k>>b) == 1
274274
Qk = mod(Qk*Q, n)
275275
U, V = U + V, V + U*D
276-
# adding n makes them even
276+
# adding n makes them even
277277
# so we can divide by 2 without causing problems
278278
isodd(U) && (U += n)
279279
isodd(V) && (V += n)
@@ -328,9 +328,9 @@ Base.isempty(f::FactorIterator) = f.n == 1
328328
#
329329

330330
"""
331-
eachfactor(n::Integer)->FactorIterator
331+
eachfactor(n::Integer)->FactorIterator
332332
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`),
334334
allocating the storage required for `factor(n)` can introduce significant overhead.
335335
"""
336336
eachfactor(n::Integer) = FactorIterator(n)
@@ -373,7 +373,7 @@ function iterate(f::FactorIterator{T}, state=(f.n, T(3))) where T
373373
_min_factor(p) == p || continue
374374
num_p = 0
375375
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`
377377
r == 0 || break
378378
num_p += 1
379379
n = q

src/factorization.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Base.setindex!(f::Factorization{T}, e::Int, p) where T
4343
end
4444

4545
"""
46-
impliments f[p] += e faster
46+
implements f[p] += e faster
4747
"""
4848
function increment!(f::Factorization{T}, e::Int, p) where T
4949
found = searchsortedfirst(f.pe, p=>0, by=first)

0 commit comments

Comments
 (0)