Skip to content

Add FriendlyNumber Implementation#7474

Open
Rosander0 wants to merge 1 commit into
TheAlgorithms:masterfrom
Rosander0:add-friendly-number
Open

Add FriendlyNumber Implementation#7474
Rosander0 wants to merge 1 commit into
TheAlgorithms:masterfrom
Rosander0:add-friendly-number

Conversation

@Rosander0

Copy link
Copy Markdown
Contributor
  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter

codecov-commenter commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.86%. Comparing base (6fbbc94) to head (3ac12ba).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7474      +/-   ##
============================================
+ Coverage     79.80%   79.86%   +0.05%     
- Complexity     7302     7336      +34     
============================================
  Files           803      808       +5     
  Lines         23751    23831      +80     
  Branches       4671     4691      +20     
============================================
+ Hits          18955    19032      +77     
  Misses         4036     4036              
- Partials        760      763       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FriendlyNumber with areFriendly(a, b) based on divisor-sum (sigma) computation.
  • Adds FriendlyNumberTest covering 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.

Comment thread src/main/java/com/thealgorithms/maths/FriendlyNumber.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/FriendlyNumber.java Outdated
Comment thread src/main/java/com/thealgorithms/maths/FriendlyNumber.java Outdated
@Rosander0 Rosander0 force-pushed the add-friendly-number branch from dd2d403 to 3ac12ba Compare June 18, 2026 12:38
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

Successfully merging this pull request may close these issues.

3 participants