JavaScript
JavaScript copied to clipboard
[FEATURE]: Add Harshad numbers
Motivation
- A Harshad number (also known as a Niven number) is an integer that is divisible by the sum of its digits.
- Harshad numbers are sometimes called “happy numbers” in recreational mathematics, because they have a simple, satisfying property: their digit sum divides them evenly. They are widely studied in number theory and often appear in math puzzles, programming challenges, and teaching exercises.
Examples
18 is a Harshad number because 1 + 8 = 9 and 18 % 9 === 0.
19 is not, because 1 + 9 = 10 and 19 % 10 !== 0
Possible workarounds
No response
Additional information
No response
Hi! I noticed that the previous PR (#1801) was closed without merging. I’d love to take up this issue and implement the Harshad number checker for Hacktoberfest 2025. Could you please assign it to me?
I have worked on the Harshad number checker and created a pull request with the implementation and tests. Please consider my contribution for this issue.