Skip to content

Commit

Permalink
Space around headings in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JSorngard committed May 7, 2024
1 parent 98986b1 commit 36c453a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ A crate for generating and working with prime numbers in const contexts.
`#![no_std]` compatible.

## Examples

Generate arrays of prime numbers with the function `primes` which uses a [segmented sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Segmented_sieve):
```rust
const PRIMES: [u32; 10] = primes();
Expand Down Expand Up @@ -49,6 +50,7 @@ assert_eq!(PRIME_STATUS, [false, false, true, true, false, true, false, true, fa
```

## Arbitrary ranges

The crate provides prime generation and sieving functions with suffixes, e.g. `primes_geq` and `sieve_lt`
that can be used to work with ranges that don't start at zero. They take two generics: the number of elements
to store in the binary and the size of the sieve used during evaluation. The sieve size must be the ceiling
Expand All @@ -64,7 +66,9 @@ const PRIME_STATUS_LT: Result<[bool; N], SieveError> = sieve_lt::<3, 70_711>(5_0
assert_eq!(PRIME_STATUS_LT, Ok([false, true, false]));
```
The sieve size can be computed by the crate by using the macro `primes_segment!` and `sieve_segment!`.

## Other functionality

Use `is_prime` to test whether a given number is prime:
```rust
const CHECK: bool = is_prime(18_446_744_073_709_551_557);
Expand Down

0 comments on commit 36c453a

Please sign in to comment.