Function malachite_base::num::factorization::primes::prime_indicator_sequence_less_than
source · pub fn prime_indicator_sequence_less_than(
limit: u64,
) -> PrimeIndicatorSequenceLessThan ⓘ
Expand description
Returns an iterator that generates an sequence of bool
s, where the $n$th bool
is true
if
and only if $n$ is prime. The first bool
generated has index 1, and the last one has index
$\max(0,\ell-1)$, where $\ell$ is limit
.
The output length is $max(0,\ell-1)$, where $\ell$ is limit
.
§Worst-case complexity (amortized)
$T(i) = O(\log \log \log i)$
$M(i) = O(1)$
where $T$ is time, $M$ is additional memory, and $i$ is the iteration index.
§Examples
use malachite_base::num::factorization::primes::prime_indicator_sequence_less_than;
let s: String = prime_indicator_sequence_less_than(101)
.map(|b| if b { '1' } else { '0' })
.collect();
assert_eq!(
s,
"01101010001010001010001000001010000010001010001000001000001010000010001010000010001000001\
00000001000"
)