Skip to content

Add Armstrong number check algorithm#14670

Closed
Khanrukku wants to merge 2 commits into
TheAlgorithms:masterfrom
Khanrukku:add-code-example
Closed

Add Armstrong number check algorithm#14670
Khanrukku wants to merge 2 commits into
TheAlgorithms:masterfrom
Khanrukku:add-code-example

Conversation

@Khanrukku
Copy link
Copy Markdown

@Khanrukku Khanrukku commented May 12, 2026

Description

Added Armstrong number (Narcissistic number) checker algorithm to the maths module.

What is an Armstrong Number?

An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits.

Examples:

  • 153 = 1³ + 5³ + 3³ = 153 ✅
  • 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴ = 9474 ✅

Implementation Features

  • ✅ Handles negative numbers (returns False)
  • ✅ Works for any number of digits
  • ✅ Includes comprehensive doctests
  • ✅ Includes example usage
  • ✅ Well-documented with clear comments
  • ✅ Follows repository coding standards
    [x] I have read CONTRIBUTING.md
    [x] This pull request is all my own work
    [x] I have added tests (doctests are included)
    [x] All tests pass

Testing

All doctests pass successfully.

@algorithms-keeper
Copy link
Copy Markdown

Closing this pull request as invalid

@Khanrukku, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the Contributing guidelines.

If you're facing any problem on how to mark a checkbox, please read the following instructions:

  • Read a point one at a time and think if it is relevant to the pull request or not.
  • If it is, then mark it by putting a x between the square bracket like so: [x]

NOTE: Only [x] is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.

@algorithms-keeper algorithms-keeper Bot added invalid awaiting reviews This PR is ready to be reviewed labels May 12, 2026
@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label May 12, 2026
@Khanrukku
Copy link
Copy Markdown
Author

@algorithms-keeper I have now checked all the required checkboxes. Please review. Thank you!

@Jags-08
Copy link
Copy Markdown

Jags-08 commented May 14, 2026

If anyone is curious about the performance profile of these validation loops, I’ve been running similar C-bound parsing tests over the last couple of days. The overhead is impressively low. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants