Skip to main content

Integer Mathematics

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Boring Math Library - Integer math package

Package of Python integer math libraries.

Repos and Documentation

Repositories

Detailed documentation

This project is part of the Boring Math bm. namespace project.

Modules

Number Theory Module

  • Number Theory
    • function gcd(int, int) -> int
      • greatest common divisor of two integers
      • always returns a non-negative number greater than 0
    • function lcm(int, int) -> int
      • least common multiple of two integers
      • always returns a non-negative number greater than 0
    • function coprime(int, int) -> tuple(int, int)
      • make 2 integers coprime by dividing out gcd
      • preserves signs of original numbers
    • function iSqrt(int) -> int
      • integer square root
      • same as math.isqrt
    • function isSqr(int) -> bool
      • returns true if integer argument is a perfect square
    • function primes(start: int, end: int) -> Iterator[int]
      • now using Wilson's Theorem
    • function legendre_symbol(a: int, p: int) ->datastructures int
      • where p > 2 is a prime number
    • function jacobi_symbol(a: int, n: int) -> int
      • where n > 0

Combinatorics Module

  • Combinatorics
    • function comb(n: int, m: int) -> int
      • returns number of combinations of n items taken m at a time
      • pure Python implementation of math.comb
        • reasonably performant
    • function perm(n: int, m: int) -> int
      • returns number of permutations of n items taken m at a time
      • pure Python implementation of math.perm
        • about 5x slower than math.perm
        • keeping around for PyPy 3.12+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boring_math_integer_math-0.8.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boring_math_integer_math-0.8.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file boring_math_integer_math-0.8.0.tar.gz.

File metadata

File hashes

Hashes for boring_math_integer_math-0.8.0.tar.gz
Algorithm Hash digest
SHA256 1f443070e739c3f50478ba529e214d39086f777e01871b2a2e12abbcf4a94843
MD5 318744bd0e690a1b904fbc48c343b43d
BLAKE2b-256 6e912d169f14114f22c78a80422dc4a3e7952b8d3dd5737948edb1e25bd82d4e

See more details on using hashes here.

File details

Details for the file boring_math_integer_math-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for boring_math_integer_math-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78307bf8abe57a09afe347f56f00bb05beb6091b76cc7799e4ec7a05bb6117ba
MD5 7ba46216d36a2b8e470c138b4866d28d
BLAKE2b-256 0cb99cde4dcc01300a88b290a5aba600eff6df734e0c7612604c1ee6a58b481a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page