Skip to content

Request to Contribute: Number Theory and Modular Arithmetic Helpers for CP #5

@Subhankar-Ray192

Description

@Subhankar-Ray192

Hello Maintainers,

I've been using this repository as part of my competitive programming workflow and have found it very helpful. I would like to ask if you are open to contributions focused on number theory and modular arithmetic utilities—tools that are commonly used in competitive programming but are not readily available or standardized in the Python ecosystem.

Proposed Contributions

If this direction aligns with the goals of the project, I would like to implement the following utilities step-by-step. Each would include clean and well-documented implementations, example usage, and optional test cases:

  • ModInt wrapper class for safe and consistent modular arithmetic (similar to C++'s modint)
  • Modular inverse functions using both Fermat’s Little Theorem and the Extended Euclidean Algorithm
  • Efficient computation of binomial coefficients under modulo (nCr % mod)
  • Sieve of Eratosthenes with smallest prime factor (SPF) support
  • Miller-Rabin primality test (probabilistic, suitable for large inputs)
  • Euler’s Totient Function and Möbius Function

The focus would be on clarity, reusability, and performance for CP-style applications.

If this proposal sounds useful, I would be happy to begin by submitting a pull request for the ModInt wrapper as a first step.

Thank you for your time and consideration. I look forward to your feedback.

Best regards,
Subhankar-Ray192

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions