Skip to main content

Python package for combination calculation

Project description

combination_py

BuildStatus PackageVersion Stable Format License

Python package for combination calculation

Installation

Use the package manager pip to install combination_py.

pip install combination-py

Usage

import combination

# combination.Combination(n_max, mod=10**9+7)
comb = combination.Combination(10 ** 6)

# comb.nCr(n, r)
comb.nCr(10, 5) # return 252

# comb.nPr(n, r)
comb.nPr(10, 5) # return 30240

# comb.nHr(n, r)
comb.nHr(10, 5) # return 2002

# 上昇階乗冪 n * (n + 1) * ... * (n + r - 1)
# comb.rising_factorial(n, r)
comb.rising_factorial(10, 5) # return 240240

# 第1種スターリング数
# n要素をk個の巡回列に分割する場合の数
# comb.stirling_first(n, k)
comb.stirling_first(10, 5) # return 269325

# 第2種スターリング数
# n要素を区別のないkグループに分割する場合の数
# comb.stirling_second(n, k)
comb.stirling_second(10, 5) # return 42525

# n要素を区別のあるkグループに分割する場合の数
# comb.balls_and_boxes_3(n, k)
comb.balls_and_boxes_3(10, 5) # return 5103000

# ベルヌーイ数
# comb.bernoulli(n)
comb.bernoulli(10) # return 348484851

# n要素をk個の空でない順序付き集合に分割する場合の数
# comb.lah(n, k)
comb.lah(10, 5) # return 3810240

# n要素をkグループ以下に分割する場合の数
# comb.bell(n, k)
comb.bell(10, 5) # return 86472

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache License 2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

combination_py-1.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file combination_py-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: combination_py-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.5

File hashes

Hashes for combination_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c23ed02e18ed4df8a327fcff7673af4b1a58595e5c45964636a7f7a9416e54c
MD5 e820891e26f98e9eab68b19a6e5486c9
BLAKE2b-256 732bb9164b237d3f10dbab44d2c6cd844f45551967d7e0d347dd5c7926a31968

See more details on using hashes here.

Supported by

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