@@ -47,20 +47,6 @@ assert!(CACHE.is_prime(1000).is_none());
47
47
assert! (CACHE . count_primes_leq (1000 ). is_none ());
48
48
```
49
49
50
- Want only the numbers? Use the ` primes ` function, or convert the cache into an array:
51
-
52
- ``` rust
53
- use const_primes :: {primes, Primes };
54
-
55
- const CACHE : Primes <10 > = Primes :: new ();
56
-
57
- const PRIMES_ARRAY1 : [u32 ; 10 ] = primes ();
58
- const PRIMES_ARRAY2 : [i32 ; 10 ] = PRIMES . into_array ();
59
-
60
- assert_eq! (PRIMES_ARRAY1 , [2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 ]);
61
- assert_eq! (PRIMES_ARRAY1 , PRIMES_ARRAY2 );
62
- ```
63
-
64
50
## Example: primality checking
65
51
66
52
Use ` is_prime ` to test whether a given number is prime:
@@ -75,13 +61,11 @@ assert!(CHECK);
75
61
76
62
## Example: generate the three primes after 5000000031
77
63
78
- The crate also provides prime generation and sieving functions that can be used
79
- to work with ranges of large numbers that don't start at zero, e.g.
80
- ` primes_geq ` and ` sieve_lt ` . These functions can use large sieves to compute
81
- large primes, but don't need to return the entire sieve, just the requested numbers.
82
- They are most conveniently used through the macros ` primes_segment! ` and
83
- ` sieve_segment! ` that automatically compute the size of the sieve that's needed
84
- for a certain computation.
64
+ The crate also provides prime generation and sieving functionality for computing arrays of
65
+ large prime numbers above or below some limit, without having to also include every single prime number from 2 and up in the
66
+ resulting constant, and thus potentially the binary.
67
+ This functionality is most conveniently accessed through the macros ` primes_segment! ` and
68
+ ` sieve_segment! ` that automatically compute the size of the prime sieve that is needed for a certain computation.
85
69
86
70
Compute 3 primes greater than or equal to 5000000031:
87
71
0 commit comments