Add FriendlyNumber Implementation#7474
Merged
DenizAltunkapan merged 2 commits intoJun 22, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7474 +/- ##
============================================
+ Coverage 79.86% 79.88% +0.01%
- Complexity 7333 7340 +7
============================================
Files 808 809 +1
Lines 23833 23847 +14
Branches 4690 4694 +4
============================================
+ Hits 19035 19050 +15
+ Misses 4036 4035 -1
Partials 762 762 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
12a8ced to
dd2d403
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new number-theory utility for detecting friendly numbers (numbers with the same abundancy index) along with a JUnit test suite to validate core behavior.
Changes:
- Introduces
FriendlyNumberwithareFriendly(a, b)based on divisor-sum (sigma) computation. - Adds
FriendlyNumberTestcovering friendly, non-friendly, and invalid input cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/main/java/com/thealgorithms/maths/FriendlyNumber.java |
Implements friendly-number check via sum-of-divisors and cross-multiplication comparison. |
src/test/java/com/thealgorithms/maths/FriendlyNumberTest.java |
Adds unit tests for expected friendly/non-friendly pairs and invalid inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dd2d403 to
3ac12ba
Compare
DenizAltunkapan
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clang-format -i --style=file path/to/your/file.java