pub trait CheckedPrimorial: Sized {
    fn checked_primorial(n: u64) -> Option<Self>;
    fn checked_product_of_first_n_primes(n: u64) -> Option<Self>;
}

Required Methods§

Implementations on Foreign Types§

Computes the primorial of a number: the product of all primes less than or equal to it.

The checked_product_of_first_n_primes function is similar; it computes the primorial of the $n$th prime.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n\#) & \text{if} \quad n\# < 2^W, \\ \operatorname{None} & \text{if} \quad n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the product of the first $n$ primes.

The checked_primorial function is similar; it computes the product of all primes less than or equal to $n$.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(p_n\#) & \text{if} \quad p_n\# < 2^W, \\ \operatorname{None} & \text{if} \quad p_n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the primorial of a number: the product of all primes less than or equal to it.

The checked_product_of_first_n_primes function is similar; it computes the primorial of the $n$th prime.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n\#) & \text{if} \quad n\# < 2^W, \\ \operatorname{None} & \text{if} \quad n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the product of the first $n$ primes.

The checked_primorial function is similar; it computes the product of all primes less than or equal to $n$.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(p_n\#) & \text{if} \quad p_n\# < 2^W, \\ \operatorname{None} & \text{if} \quad p_n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the primorial of a number: the product of all primes less than or equal to it.

The checked_product_of_first_n_primes function is similar; it computes the primorial of the $n$th prime.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n\#) & \text{if} \quad n\# < 2^W, \\ \operatorname{None} & \text{if} \quad n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the product of the first $n$ primes.

The checked_primorial function is similar; it computes the product of all primes less than or equal to $n$.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(p_n\#) & \text{if} \quad p_n\# < 2^W, \\ \operatorname{None} & \text{if} \quad p_n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the primorial of a number: the product of all primes less than or equal to it.

The checked_product_of_first_n_primes function is similar; it computes the primorial of the $n$th prime.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n\#) & \text{if} \quad n\# < 2^W, \\ \operatorname{None} & \text{if} \quad n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the product of the first $n$ primes.

The checked_primorial function is similar; it computes the product of all primes less than or equal to $n$.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(p_n\#) & \text{if} \quad p_n\# < 2^W, \\ \operatorname{None} & \text{if} \quad p_n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the primorial of a number: the product of all primes less than or equal to it.

The checked_product_of_first_n_primes function is similar; it computes the primorial of the $n$th prime.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n\#) & \text{if} \quad n\# < 2^W, \\ \operatorname{None} & \text{if} \quad n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the product of the first $n$ primes.

The checked_primorial function is similar; it computes the product of all primes less than or equal to $n$.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(p_n\#) & \text{if} \quad p_n\# < 2^W, \\ \operatorname{None} & \text{if} \quad p_n\# \geq 2^W, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the primorial of a usize: the product of all primes less than or equal to it.

The checked_product_of_first_n_primes function is similar; it computes the primorial of the $n$th prime.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(n\#) & \text{if} \quad n\# < 2^W, \\ \operatorname{None} & \text{if} \quad n\# \geq 2^W, \end{cases} $$ where $W$ is usize::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Computes the product of the first $n$ primes.

The checked_primorial function is similar; it computes the product of all primes less than or equal to $n$.

If the input is too large, the function returns None.

$$ f(n) = \begin{cases} \operatorname{Some}(p_n\#) & \text{if} \quad p_n\# < 2^W, \\ \operatorname{None} & \text{if} \quad p_n\# \geq 2^W, \end{cases} $$ where $W$ is usize::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors§