codinasion-archive / codinasion-programme

An open source codebase for sharing programming solutions.
https://codinasion.vercel.app/programme
MIT License
62 stars 147 forks source link

Armstrong Number documentation and code is incorrect #655

Closed Dentyr closed 2 years ago

Dentyr commented 2 years ago

Description

As stated in Wikipedia, including other sources: (https://en.wikipedia.org/wiki/Narcissistic_number) "In number theory, a narcissistic number (also known as a pluperfect digital invariant, an Armstrong number, or a plus perfect number) in a given number base b is a number that is the sum of its own digits each raised to the power of the number of digits."

Meanwhile, in the current documentation: "Armstrong number is a number that is equal to the sum of cubes of its digits."

So in the python script, it says, while temp > 0: digit = temp % 10 sum += digit ** 3 temp //= 10

For Armstrong numbers which have 3 digits, this will be correct. However, for any other Armstrong numbers, like 1634, the program will incorrectly say that it is not an Armstrong number.

Screenshots

No response

Additional information

No response

welcome[bot] commented 2 years ago

💖 Thanks for opening this issue. 💖

A Codinasion team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

harshraj8843 commented 2 years ago

Hey @Dentyr

Thanks for noticing this issue 👍🏻

This issue will be resolved soon

siddhantchimankar commented 2 years ago

Hey @harshraj8843 can I work on this issue?

harshraj8843 commented 2 years ago

Hey @harshraj8843 can I work on this issue?

Sure 👍🏻

Steps to resolve this issue :-