pub const fn integer_decreasing_range_to_negative_infinity(
a: Integer,
) -> IntegerDecreasingRangeToNegativeInfinity ⓘ
Expand description
Generates all Integer
s less than or equal to some number $a$, in descending order.
The output is $(-k)_{k=-a}^{\infty}$.
The output length is infinite.
§Worst-case complexity per iteration
$T(i) = O(i)$
$M(i) = O(i)$
where $T$ is time, $M$ is additional memory, and $i$ is the iteration number.
Although the time and space complexities are worst-case linear, the worst case is very rare. If
we exclude the cases where the the previously-generated value is negative and the
least-significant limb of its absolute value is Limb::MAX
, the worst case space and time
complexities are constant.
§Examples
use malachite_base::iterators::prefix_to_string;
use malachite_nz::integer::exhaustive::integer_decreasing_range_to_negative_infinity;
use malachite_nz::integer::Integer;
assert_eq!(
prefix_to_string(
integer_decreasing_range_to_negative_infinity(Integer::from(4)),
10
),
"[4, 3, 2, 1, 0, -1, -2, -3, -4, -5, ...]"
)