Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.100.1/docs/apis/_sources/natural_0.rst.txt

.. index:: single: natural .. _natural/0:

.. rst-class:: right

object

natural

Natural numbers data type predicates.

| Availability: | logtalk_load(types(loader))

| Author: Paulo Moura | Version: 2:3:0 | Date: 2026-05-13

| Compilation flags: | static, context_switching_calls

| Extends: | public :ref:`integer <integer/0>` | Uses: | :ref:`list <list/0>` | :ref:`numberlist <numberlist/0>`

| Remarks: | (none)

| Inherited public predicates: |  :ref:`comparingp/0::(<)/2`  :ref:`comparingp/0::(=:=)/2`  :ref:`comparingp/0::(=<)/2`  :ref:`comparingp/0::(=\=)/2`  :ref:`number/0::=~= / 2`  :ref:`comparingp/0::(>)/2`  :ref:`comparingp/0::(>=)/2`  :ref:`number/0::approximately_equal/2`  :ref:`number/0::approximately_equal/3`  :ref:`integer/0::between/3`  :ref:`termp/0::check/1`  :ref:`termp/0::depth/2`  :ref:`number/0::essentially_equal/3`  :ref:`termp/0::ground/1`  :ref:`termp/0::new/1`  :ref:`termp/0::numbervars/1`  :ref:`termp/0::numbervars/3`  :ref:`termp/0::occurs/2`  :ref:`integer/0::plus/3`  :ref:`integer/0::power_sequence/4`  :ref:`integer/0::sequence/3`  :ref:`integer/0::sequence/4`  :ref:`termp/0::singletons/2`  :ref:`termp/0::subsumes/2`  :ref:`termp/0::subterm/2`  :ref:`integer/0::succ/2`  :ref:`number/0::tolerance_equal/4`  :ref:`termp/0::valid/1`  :ref:`termp/0::variables/2`  :ref:`termp/0::variant/2`  :ref:`termp/0::varnumbers/2`  :ref:`termp/0::varnumbers/3`  

.. contents:: :local: :backlinks: top

Public predicates

.. index:: factorial/2 .. _natural/0::factorial/2:

factorial/2 ^^^^^^^^^^^^^^^

Computes the factorial of a non-negative integer.

| Compilation flags: | static

| Template: | factorial(N,Factorial) | Mode and number of proofs: | factorial(+non_negative_integer,-non_negative_integer) - one


.. index:: fibonacci/2 .. _natural/0::fibonacci/2:

fibonacci/2 ^^^^^^^^^^^^^^^

Computes the Fibonacci number of a non-negative integer.

| Compilation flags: | static

| Template: | fibonacci(N,Fibonacci) | Mode and number of proofs: | fibonacci(+non_negative_integer,-non_negative_integer) - one


.. index:: lucas/2 .. _natural/0::lucas/2:

lucas/2 ^^^^^^^^^^^

Computes the Lucas number of a non-negative integer.

| Compilation flags: | static

| Template: | lucas(N,Lucas) | Mode and number of proofs: | lucas(+non_negative_integer,-non_negative_integer) - one


.. index:: falling_factorial/3 .. _natural/0::falling_factorial/3:

falling_factorial/3 ^^^^^^^^^^^^^^^^^^^^^^^

Computes the falling factorial. N must be greater than or equal to K (fails otherwise).

| Compilation flags: | static

| Template: | falling_factorial(N,K,FallingFactorial) | Mode and number of proofs: | falling_factorial(+non_negative_integer,+non_negative_integer,-non_negative_integer) - zero_or_one


.. index:: rising_factorial/3 .. _natural/0::rising_factorial/3:

rising_factorial/3 ^^^^^^^^^^^^^^^^^^^^^^

Computes the rising factorial.

| Compilation flags: | static

| Template: | rising_factorial(N,K,RisingFactorial) | Mode and number of proofs: | rising_factorial(+non_negative_integer,+non_negative_integer,-non_negative_integer) - one


.. index:: catalan/2 .. _natural/0::catalan/2:

catalan/2 ^^^^^^^^^^^^^

Computes the Catalan number of a non-negative integer.

| Compilation flags: | static

| Template: | catalan(N,Catalan) | Mode and number of proofs: | catalan(+non_negative_integer,-non_negative_integer) - one


.. index:: subfactorial/2 .. _natural/0::subfactorial/2:

subfactorial/2 ^^^^^^^^^^^^^^^^^^

Computes the subfactorial of a non-negative integer.

| Compilation flags: | static

| Template: | subfactorial(N,Subfactorial) | Mode and number of proofs: | subfactorial(+non_negative_integer,-non_negative_integer) - one


.. index:: bell/2 .. _natural/0::bell/2:

bell/2 ^^^^^^^^^^

Computes the Bell number of a non-negative integer.

| Compilation flags: | static

| Template: | bell(N,Bell) | Mode and number of proofs: | bell(+non_negative_integer,-non_negative_integer) - one


.. index:: stirling_first/3 .. _natural/0::stirling_first/3:

stirling_first/3 ^^^^^^^^^^^^^^^^^^^^

Computes the unsigned Stirling number of the first kind. N must be greater than or equal to K (fails otherwise).

| Compilation flags: | static

| Template: | stirling_first(N,K,Stirling) | Mode and number of proofs: | stirling_first(+non_negative_integer,+non_negative_integer,-non_negative_integer) - zero_or_one


.. index:: stirling_second/3 .. _natural/0::stirling_second/3:

stirling_second/3 ^^^^^^^^^^^^^^^^^^^^^

Computes the Stirling number of the second kind. N must be greater than or equal to K (fails otherwise).

| Compilation flags: | static

| Template: | stirling_second(N,K,Stirling) | Mode and number of proofs: | stirling_second(+non_negative_integer,+non_negative_integer,-non_negative_integer) - zero_or_one


.. index:: partition_number/2 .. _natural/0::partition_number/2:

partition_number/2 ^^^^^^^^^^^^^^^^^^^^^^

Computes the partition number of a non-negative integer.

| Compilation flags: | static

| Template: | partition_number(N,PartitionNumber) | Mode and number of proofs: | partition_number(+non_negative_integer,-non_negative_integer) - one


.. index:: binomial/3 .. _natural/0::binomial/3:

binomial/3 ^^^^^^^^^^^^^^

Computes the binomial coefficient. N must be greater than or equal to K (fails otherwise).

| Compilation flags: | static

| Template: | binomial(N,K,Binomial) | Mode and number of proofs: | binomial(+non_negative_integer,+non_negative_integer,-non_negative_integer) - zero_or_one


.. index:: multinomial/2 .. _natural/0::multinomial/2:

multinomial/2 ^^^^^^^^^^^^^^^^^

Computes the multinomial coefficient for a list of non-negative integers.

| Compilation flags: | static

| Template: | multinomial(Integers,Multinomial) | Mode and number of proofs: | multinomial(+list(non_negative_integer),-non_negative_integer) - one


Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)