# Boring Math Library - Integer math package
Package of Python integer math libraries.
- [Number theory](#number-theory-module): `bm.integer_math.num_theory`
- [Combinatorics](#combinatorics-module): `bm.integer_math.combinatorics`
## Repos and Documentation
### Repositories
- [bm.integer-math][1] project on *PyPI*
- [Source code][2] on *GitHub*
### Detailed documentation
- [Detailed API documentation][3] on *GH-Pages*
This project is part of the
[Boring Math][4] **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+
______________________________________________________________________
[1]: https://pypi.org/project/bm.integer-math/
[2]: https://github.com/grscheller/bm-integer-math/
[3]: https://grscheller.github.io/boring-math-docs/integer-math/
[4]: https://github.com/grscheller/boring-math-docs
Raw data
{
"_id": null,
"home_page": null,
"name": "bm.integer-math",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "comb, combinations, combinatorics, gcd, integer, lcm, math, number-theory, primes",
"author": null,
"author_email": "\"Geoffrey R. Scheller\" <geoffrey@scheller.com>",
"download_url": "https://files.pythonhosted.org/packages/25/a6/1b3c46314fb16fdbc6df2a8dc8a2bb69e3e1119d945dddbd3a2c4d0f629d/bm_integer_math-0.7.0.tar.gz",
"platform": null,
"description": "# Boring Math Library - Integer math package\n\nPackage of Python integer math libraries.\n\n- [Number theory](#number-theory-module): `bm.integer_math.num_theory`\n- [Combinatorics](#combinatorics-module): `bm.integer_math.combinatorics`\n\n## Repos and Documentation\n\n### Repositories\n\n- [bm.integer-math][1] project on *PyPI*\n- [Source code][2] on *GitHub*\n\n### Detailed documentation\n\n- [Detailed API documentation][3] on *GH-Pages*\n\nThis project is part of the\n[Boring Math][4] **bm.** namespace project.\n\n## Modules\n\n### Number Theory Module\n\n- Number Theory\n - *function* gcd(int, int) -> int\n - greatest common divisor of two integers\n - always returns a non-negative number greater than 0\n - *function* lcm(int, int) -> int\n - least common multiple of two integers\n - always returns a non-negative number greater than 0\n - *function* coprime(int, int) -> tuple(int, int)\n - make 2 integers coprime by dividing out gcd\n - preserves signs of original numbers\n - *function* iSqrt(int) -> int\n - integer square root\n - same as math.isqrt\n - *function* isSqr(int) -> bool\n - returns true if integer argument is a perfect square\n - *function* primes(start: int, end: int) -> Iterator[int]\n - now using *Wilson's Theorem*\n - *function* legendre_symbol(a: int, p: int) ->datastructures int\n - where `p > 2` is a prime number\n - *function* jacobi_symbol(a: int, n: int) -> int\n - where `n > 0`\n\n______________________________________________________________________\n\n### Combinatorics Module\n\n- Combinatorics\n - *function* comb(n: int, m: int) -> int\n - returns number of combinations of n items taken m at a time\n - pure Python implementation of math.comb\n - reasonably performant\n - *function* perm(n: int, m: int) -> int\n - returns number of permutations of n items taken m at a time\n - pure Python implementation of math.perm\n - about 5x slower than `math.perm`\n - keeping around for PyPy 3.12+\n\n______________________________________________________________________\n\n[1]: https://pypi.org/project/bm.integer-math/\n[2]: https://github.com/grscheller/bm-integer-math/\n[3]: https://grscheller.github.io/boring-math-docs/integer-math/\n[4]: https://github.com/grscheller/boring-math-docs\n",
"bugtrack_url": null,
"license": null,
"summary": "Integer Mathematics",
"version": "0.7.0",
"project_urls": {
"Changelog": "https://grscheller.github.io/bm-integer-math/html/changelog.html",
"Documentation": "https://grscheller.github.io/bm-integer-math/html/",
"Homepage": "https://github.com/grscheller/bm-docs/blob/main/README.md",
"Source": "https://github.com/grscheller/bm-integer-math"
},
"split_keywords": [
"comb",
" combinations",
" combinatorics",
" gcd",
" integer",
" lcm",
" math",
" number-theory",
" primes"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e9aa0a3c3a3f10fe0b2a6aea6cf9e95d6b140cf4358b7d59aa2227b2b70e139c",
"md5": "14c3176dd4da741208ddf49ebfb2e549",
"sha256": "9edc3db046fa0c23a8e7a4c390507543fd6d834e6786cfdc94867e54fc362b5c"
},
"downloads": -1,
"filename": "bm_integer_math-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "14c3176dd4da741208ddf49ebfb2e549",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 10515,
"upload_time": "2025-07-14T17:59:43",
"upload_time_iso_8601": "2025-07-14T17:59:43.370627Z",
"url": "https://files.pythonhosted.org/packages/e9/aa/0a3c3a3f10fe0b2a6aea6cf9e95d6b140cf4358b7d59aa2227b2b70e139c/bm_integer_math-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "25a61b3c46314fb16fdbc6df2a8dc8a2bb69e3e1119d945dddbd3a2c4d0f629d",
"md5": "c1e23e32794108795b789d29b3967a5c",
"sha256": "ddecf9d606039d61ab0e9a87038fbeeb0c057cd6bf69da78d24b6cf1d8484a56"
},
"downloads": -1,
"filename": "bm_integer_math-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "c1e23e32794108795b789d29b3967a5c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 10830,
"upload_time": "2025-07-14T17:59:44",
"upload_time_iso_8601": "2025-07-14T17:59:44.646563Z",
"url": "https://files.pythonhosted.org/packages/25/a6/1b3c46314fb16fdbc6df2a8dc8a2bb69e3e1119d945dddbd3a2c4d0f629d/bm_integer_math-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 17:59:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "grscheller",
"github_project": "bm-docs",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bm.integer-math"
}