Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer Modulo n #436

Open
muratcankilic96 opened this issue Oct 25, 2021 · 3 comments
Open

Integer Modulo n #436

muratcankilic96 opened this issue Oct 25, 2021 · 3 comments

Comments

@muratcankilic96
Copy link

Are there any future plans to add integer modulo n?

I mean features such as multiplicative/additive inverses modulo n, order a modulo n, primitive roots modulo n, quadratic residues etc.

@markrogoyski
Copy link
Owner

Hi @muratcankilic96,

Thank you for your interest in MathPHP. And thank you for your feature request.

We can consider modular arithmetic for upcoming feature development. What kinds of things are you looking to do? And what specific functions do you consider "must haves" vs "nice to have?"

And are there any reference libraries with similar functionality that you think have good interfaces/APIs (or bad interfaces/APIs)?

Thanks,
Mark

@muratcankilic96
Copy link
Author

muratcankilic96 commented Oct 26, 2021

Hello @markrogoyski

Thanks for replying.

Must have features are:

  • Find x mod n
  • Find a^b mod n
  • Find a! mod n
  • Whether a and b are congruent mod n
  • Additive and multiplicative inverses mod n
  • Order of a mod n
  • Primitive roots mod n
    • Whether the congruence system has primitive roots or not mod n
    • Count of primitive roots (if exists) mod n
    • List of primitive roots mod n
    • Whether r is a primitive root or not
    • Index base r of a mod n

Nice to have:

  • Solve linear congruences of the form axb (mod n)
  • Quadratic residue: Legendre and Jacobi symbols

For reference, I have implemented several modular arithmetic features myself in C#. We need Euler totient function and MathPHP already supports that.

@Beakerboy
Copy link
Contributor

If you have already implemented several of these in another language, please translate them into PHP, add some unit tests, and submit the work in a merge request. That would be the fastest way to see these features in this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants