Positive Integers#

class sage.sets.positive_integers.PositiveIntegers#

Bases: IntegerRangeInfinite

The enumerated set of positive integers. To fix the ideas, we mean \(\{1, 2, 3, 4, 5, \dots \}\).

This class implements the set of positive integers, as an enumerated set (see InfiniteEnumeratedSets).

This set is an integer range set. The construction is therefore done by IntegerRange (see IntegerRange).

EXAMPLES:

sage: PP = PositiveIntegers()
sage: PP
Positive integers
sage: PP.cardinality()
+Infinity
sage: TestSuite(PP).run()
sage: PP.list()
Traceback (most recent call last):
...
NotImplementedError: cannot list an infinite set
sage: it = iter(PP)
sage: (next(it), next(it), next(it), next(it), next(it))
(1, 2, 3, 4, 5)
sage: PP.first()
1
an_element()#

Returns an element of self.

EXAMPLES:

sage: PositiveIntegers().an_element()
42