arctans.primes ============== .. py:module:: arctans.primes .. autoapi-nested-parse:: Mathematical utility functions. Attributes ---------- .. autoapisummary:: arctans.primes.primes Functions --------- .. autoapisummary:: arctans.primes.pfactors arctans.primes.largest_pfactor arctans.primes.is_prime arctans.primes.is_irreducible arctans.primes.is_gaussian_prime arctans.primes.is_gaussian_unit arctans.primes.complex_factorise Module Contents --------------- .. py:data:: primes :value: [2] .. py:function:: pfactors(n: int) -> list[arctans.numbers.Integer] Get list of all prime factors of n. :param n: An integer :returns: A list of the prime factors of n, including factors multiple times when they appear more than once in the prime factorisation .. py:function:: largest_pfactor(n: int | arctans.numbers.Integer) -> arctans.numbers.Integer Compute the largest prime factor of n. :param n: An integer :returns: The largest prime factor of n .. py:function:: is_prime(n: arctans.numbers.Integer | int) -> bool Check if an integer is prime. :param n: An integer :returns: True if n is prime .. py:function:: is_irreducible(n: arctans.numbers.Integer | int) -> bool Check if arctan(n) is irreducible. An arctan is irreducible iff it cannot be written as a weighted sum of integer arccotangents, or equivalently arctan(n) is irreducible iff the largest prime factor of 1 + n**2 is greater than or equal to 2*n. :param n: An integer :returns: True if n is irreducible .. py:function:: is_gaussian_prime(n: arctans.numbers.GaussianInteger) -> bool Check if n is a Gaussian prime. :param n: An integer :returns: True if n is a Gaussian prime .. py:function:: is_gaussian_unit(n: arctans.numbers.GaussianInteger) -> bool Check if n is a Gaussian unit. :param n: An integer :returns: True if n is 1, -1, i or -i .. py:function:: complex_factorise(n: arctans.numbers.GaussianInteger, istart: int = 0) -> list[arctans.numbers.GaussianInteger] Factorise a Gaussian integer into Gaussian primes. :param n: An integer :returns: A list of Gaussian primes