Integer

Integer()

Methods

Name Description
is_prime Check if the 64-bit number n is a prime number.
prime_iter Create an iterator over all 64-bit prime numbers starting from start.
solve_integer_relation Use the PSLQ algorithm to find a vector of integers a that satisfies a.x = 0,

is_prime

Integer.is_prime(_cls, n)

Check if the 64-bit number n is a prime number.

prime_iter

Integer.prime_iter(_cls, start=1)

Create an iterator over all 64-bit prime numbers starting from start.

solve_integer_relation

Integer.solve_integer_relation(_cls, x, tolerance, max_coeff=None, gamma=None)

Use the PSLQ algorithm to find a vector of integers a that satisfies a.x = 0, where every element of a is less than max_coeff, using a specified tolerance and number of iterations. The parameter gamma must be more than or equal to 2/sqrt(3).

Examples

Solve a 32.0177=b*pi+c*e where b and c are integers:

>>> r = Integer.solve_integer_relation([-32.0177, 3.1416, 2.7183], 1e-5, 100)
>>> print(r)

yields [1,5,6].