fave77 / Mathball

A JavaScript library for Competitive Programming
https://fave77.github.io/Mathball-Docs/
MIT License
99 stars 49 forks source link

Euler's Totient function #118

Closed nilshah98 closed 5 years ago

nilshah98 commented 5 years ago

Do the checklist before filing the issue:

NOTE: Provide a clear and concise description of the feature that needs to be added! Or if its a bug, then provide the necessary steps to reproduce it along with screenshots.

Euler’s Totient function for an input n is the count of numbers in {1, 2, 3, …, n} that are relatively prime to n, i.e., the numbers whose GCD (Greatest Common Divisor) with n is 1.

M.phi(6) = 2

M.phi(2.215)        //Error floats not allowed
M.phi(-2)             //Error negative numbers not allowed
M.phi("1")            //Error strings not allowed
M.phi(False)         //Error boolean not allowed

The following function has many applications, especially in RSA algorithm.

Links- Euler's Totient GFG

Implement the algorithm listed at the end, in the above link, since it is more efficient

Manvityagi commented 5 years ago

Can I work on this ?

fave77 commented 5 years ago

@Manvityagi first complete your current PR!

Manvityagi commented 5 years ago

yeah sure! I thought it was done! but found merge conflicts later.

fave77 commented 5 years ago

@Manvityagi you're assigned!