Trait malachite_base::num::arithmetic::traits::LegendreSymbol

source ·
pub trait LegendreSymbol<RHS = Self> {
    // Required method
    fn legendre_symbol(self, other: RHS) -> i8;
}
Expand description

Calculates the Legendre symbol of two numbers. Typically the implementations will be identical to those of JacobiSymbol.

Required Methods§

source

fn legendre_symbol(self, other: RHS) -> i8

Implementations on Foreign Types§

source§

impl LegendreSymbol for i8

source§

fn legendre_symbol(self, n: i8) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even or negative.

§Examples

See here.

source§

impl LegendreSymbol for i16

source§

fn legendre_symbol(self, n: i16) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even or negative.

§Examples

See here.

source§

impl LegendreSymbol for i32

source§

fn legendre_symbol(self, n: i32) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even or negative.

§Examples

See here.

source§

impl LegendreSymbol for i64

source§

fn legendre_symbol(self, n: i64) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even or negative.

§Examples

See here.

source§

impl LegendreSymbol for i128

source§

fn legendre_symbol(self, n: i128) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even or negative.

§Examples

See here.

source§

impl LegendreSymbol for isize

source§

fn legendre_symbol(self, n: isize) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even or negative.

§Examples

See here.

source§

impl LegendreSymbol for u8

source§

fn legendre_symbol(self, n: u8) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even.

§Examples

See here.

source§

impl LegendreSymbol for u16

source§

fn legendre_symbol(self, n: u16) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even.

§Examples

See here.

source§

impl LegendreSymbol for u32

source§

fn legendre_symbol(self, n: u32) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even.

§Examples

See here.

source§

impl LegendreSymbol for u64

source§

fn legendre_symbol(self, n: u64) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even.

§Examples

See here.

source§

impl LegendreSymbol for u128

source§

fn legendre_symbol(self, n: u128) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even.

§Examples

See here.

source§

impl LegendreSymbol for usize

source§

fn legendre_symbol(self, n: usize) -> i8

Computes the Legendre symbol of two numbers.

This implementation is identical to that of JacobiSymbol, since there is no computational benefit to requiring that the denominator be prime.

$$ f(x, y) = \left ( \frac{x}{y} \right ). $$

§Worst-case complexity

$T(n) = O(n^2)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is max(self.significant_bits(), other.significant_bits()).

§Panics

Panics if n is even.

§Examples

See here.

Implementors§