pub const fn exhaustive_negative_rationals() -> ExhaustiveNegativeRationals 
Expand description

Generates all negative Rationals.

The sequence is the same as the sequence of positive Rationals, but negated. See exhaustive_positive_rationals for details.

The output length is infinite. The absolute values of the numerators and denominators of the $n$th element are $O(n^\frac{\log \phi}{\log 2})$.

§Worst-case complexity per iteration

$T(i) = O(\log i \log\log i \log\log\log i)$

$M(i) = O(\log i \log\log i)$

where $T$ is time, $M$ is additional memory, and $n$ is the iteration number.

§Examples

use malachite_base::iterators::prefix_to_string;
use malachite_q::exhaustive::exhaustive_negative_rationals;

assert_eq!(
    prefix_to_string(exhaustive_negative_rationals(), 20),
    "[-1, -1/2, -2, -1/3, -3/2, -2/3, -3, -1/4, -4/3, -3/5, -5/2, -2/5, -5/3, -3/4, -4, -1/5, \
    -5/4, -4/7, -7/3, -3/8, ...]"
)