-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add euler totient function #882
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
Add euler totient function #882
Conversation
…rime factorization method - Includes comprehensive tests for small numbers, primes, prime powers, and larger values - All tests pass and follows project naming conventions
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #882 +/- ##
==========================================
- Coverage 95.51% 95.47% -0.04%
==========================================
Files 317 318 +1
Lines 22954 22975 +21
==========================================
+ Hits 21924 21935 +11
- Misses 1030 1040 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I am having a hard time with this one, cf. #875 (review). @siriak: what is your opinion? @triuyen: in case it will be decided that it will be merged: please reach the 100% coverage and express the tests in a more parametrized way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, I think we can still include this one because it's more efficient, it doesn't allocate all divisors in array to get their number. Just make sure to parameterize tests, thanks!
Thanks! I’ll go ahead and parameterize the tests as suggested. Let me know if anything else is needed before merging. |
Co-authored-by: Piotr Idzik <[email protected]>
Co-authored-by: Piotr Idzik <[email protected]>
Co-authored-by: Piotr Idzik <[email protected]>
…en/Rust into add-euler-totient-function
Description
This PR adds an implementation of Euler's totient function φ(n) to the number theory section.
compute_totient
function by providing single-value calculationType of change
n
(vs. computing all values up ton
)Implementation details
pub fn eulers_totient(n: u64) -> u64
Checklist:
cargo clippy --all -- -D warnings
just before my last commit and fixed any issue that was found.cargo fmt
just before my last commit.cargo test
just before my last commit and all tests passed.mod.rs
file within its own folder, and in any parent folder(s).DIRECTORY.md
with the correct link.COUNTRIBUTING.md
and my code follows its guidelines.