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 integer
Uses:
Remarks:
(none)

Public predicates

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

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

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

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

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

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

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

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

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

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

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

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

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)