Function malachite_base::num::factorization::primes::prime_indicator_sequence
source · pub fn prime_indicator_sequence() -> PrimeIndicatorSequence ⓘ
Expand description
Returns an iterator that generates an infinite 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.
The output length is infinite.
§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;
let s: String = prime_indicator_sequence()
.take(100)
.map(|b| if b { '1' } else { '0' })
.collect();
assert_eq!(
s,
"01101010001010001010001000001010000010001010001000001000001010000010001010000010001000001\
00000001000"
)