represents the domain of non-negative integers, as in x∈NonNegativeIntegers.
NonNegativeIntegers
represents the domain of non-negative integers, as in x∈NonNegativeIntegers.
Details
- x∈NonNegativeIntegers evaluates immediately if x is a numeric quantity.
- Simplify [expr∈NonNegativeIntegers,assum] can be used to try to determine whether an expression is a non-negative integer under the given assumptions.
- (x1|x2|…)∈NonNegativeIntegers and {x1,x2,…}∈NonNegativeIntegers test whether all xi are non-negative integers.
- NonNegativeIntegers is output in StandardForm or TraditionalForm as TemplateBox[{}, NonNegativeIntegers]. This typeset form can be input using nnints.
Examples
open all close allBasic Examples (3)
Seven is a non-negative integer:
If is an integer, is a non-negative integer:
Find non-negative integer solutions of a Pell equation:
Scope (6)
Test domain membership of a numeric expression:
Make domain membership assumptions:
Specify the default domain over which a function should work:
Solve an optimization problem over the non-negative integers:
Test whether several numbers are non-negative integers:
If any number is explicitly not a non-negative integer, the result is False :
TraditionalForm formatting:
Applications (1)
Testing membership in the non-negative integers is a fast way to verify non-negativity of a large list:
Properties & Relations (3)
Membership in NonNegativeIntegers is equivalent to membership in Integers and non-negativity:
NonNegativeIntegers is contained in NonNegativeReals and NonNegativeRationals :
NonNegativeIntegers is disjoint from NegativeIntegers :
It intersects NonPositiveIntegers :
Related Guides
History
Text
Wolfram Research (2019), NonNegativeIntegers, Wolfram Language function, https://reference.wolfram.com/language/ref/NonNegativeIntegers.html.
CMS
Wolfram Language. 2019. "NonNegativeIntegers." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NonNegativeIntegers.html.
APA
Wolfram Language. (2019). NonNegativeIntegers. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NonNegativeIntegers.html
BibTeX
@misc{reference.wolfram_2025_nonnegativeintegers, author="Wolfram Research", title="{NonNegativeIntegers}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/NonNegativeIntegers.html}", note=[Accessed: 16-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_nonnegativeintegers, organization={Wolfram Research}, title={NonNegativeIntegers}, year={2019}, url={https://reference.wolfram.com/language/ref/NonNegativeIntegers.html}, note=[Accessed: 16-November-2025]}