JavaScript icon indicating copy to clipboard operation
JavaScript copied to clipboard

[FEATURE]: Add Harshad numbers

Open ridge-kimani opened this issue 3 months ago • 2 comments

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

ridge-kimani avatar Sep 24 '25 18:09 ridge-kimani

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?

Randomlyclueless avatar Oct 25 '25 19:10 Randomlyclueless

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.

Randomlyclueless avatar Oct 26 '25 06:10 Randomlyclueless