-
Notifications
You must be signed in to change notification settings - Fork 20k
[BUG] <Issue in Armstrong Number> #4617
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
Comments
I request the maintainer(s) to label this with "hacktoberfest" label. |
Hey @satyabarghav . I would like to work on this issue. Please assign it to me under Hacktoberfest 23 |
I would like to contribute to this issue. I have a deep knowledge of DSA and CP topics so I think I can contribute to this and more such issues. |
I think i will solve this issue |
hy @satyabarghav . can you please label your all issues to hacktoberfest2023 . it will help us to solve your all issues more passionately. |
I have resolved the bug Please review : #4625 |
Uh oh!
There was an error while loading. Please reload this page.
Description
According to the definition: It is a number that is equal to the sum of its own digits, each raised to the power of the number of digits.
But with the given implementation in the repo the digit is not raised to the power of number of Digits but instead raised only to 3.
It can be explained with the help of the Example:
1634 is an Armstrong Number as => 1^4 + 6^4 + 3^4 + 4^4 = 1634
but according to the implementation we have it will evaluated as 1^3 + 6^3 + 3^3 + 4^3 = 308 != 1634 and will not be an Armstrong Number. The code works fine for the 3 digit numbers but isn't valid for numbers above that threshold
Generalization
In other words, if you take an n-digit number and raise each of its digits to the nth power, and then sum these values, if the result is equal to the original number, it is considered an Armstrong number.
Excepted behavior
So we need to change the logic of the code to make the 3 in the Power function variable to the given input.
The text was updated successfully, but these errors were encountered: