Skip to content

[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

Closed
satyabarghav opened this issue Oct 4, 2023 · 6 comments
Closed

[BUG] <Issue in Armstrong Number> #4617

satyabarghav opened this issue Oct 4, 2023 · 6 comments
Labels

Comments

@satyabarghav
Copy link
Contributor

satyabarghav commented Oct 4, 2023

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.

@satyabarghav
Copy link
Contributor Author

I request the maintainer(s) to label this with "hacktoberfest" label.

@VishnuAmit
Copy link

Hey @satyabarghav . I would like to work on this issue. Please assign it to me under Hacktoberfest 23

@Tej-as1
Copy link

Tej-as1 commented Oct 4, 2023

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.

@Sayandas8466
Copy link

I think i will solve this issue

@NamanGoyal17
Copy link

hy @satyabarghav . can you please label your all issues to hacktoberfest2023 . it will help us to solve your all issues more passionately.

@faizan0702
Copy link

I have resolved the bug Please review : #4625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants