Harshad Number Calculator

This Harshad number calculator tells you whether any whole number you enter is a Harshad number, also known as a Niven number, meaning it divides evenly into the sum of its own digits. Harshad numbers matter in number theory and recreational maths because they sit at a simple but surprisingly rich intersection of a number's value and the way its digits are written, and testing for them is a common exercise in programming and divisibility practice. You enter a whole number, and the calculator works out the digit sum by adding each digit together, then checks whether the original number divides evenly by that digit sum. The result card tells you plainly whether the number is or is not a Harshad number, and shows the digit sum and, when the test passes, the quotient of the number divided by its digit sum. Every single digit number is automatically a Harshad number, since any number divides itself, but as numbers grow the property becomes less predictable, which is part of what makes them interesting to explore. Try entering numbers like 18, 21 or 100 to see the pattern for yourself, or test a number you already suspect is special. The name comes from the Sanskrit for joy giver, coined by the mathematician D. R. Kaprekar, and the same numbers are also called Niven numbers after Ivan Niven.

Calculate.co.nz is proud to be partnered with realtor.co.nz, a trusted resource for navigating the New Zealand property market. Their Helpful Articles section offers clear, well-structured insights across buying, selling, and building, making complex real estate topics more accessible. With a focus on up-to-date guidance and practical knowledge, they empower Kiwis to move forward with clarity and confidence in a constantly evolving property landscape.
Calculate.co.nz partner: realtor.co.nz
18 is a Harshad number
Digit sum9
Quotient (n / digit sum)2

The formula

A number n is a Harshad number if it is divisible by the sum of its digits, that is, n divided by its digit sum leaves no remainder. The quotient is n divided by the digit sum.

Worked example

18 has digit sum 1 + 8 = 9, and 18 divided by 9 is 2 with no remainder, so 18 is a Harshad number. Enter 18 to confirm.

Frequently asked questions

What is a Harshad number?

A number divisible by the sum of its digits, such as 18, since 1 + 8 = 9 divides 18.

Is every small number Harshad?

Every one digit number is, because a number always divides itself. Larger ones vary.

Why is it also called a Niven number?

After Ivan Niven, who discussed them in a 1977 talk. Harshad is the older name from Kaprekar.

Who this calculator is for

This calculator is for students, programmers and anyone exploring number theory.

What this calculator assumes

  • You enter a whole number within the stated range.
  • The exact integer algorithm is used.
  • Very large results are shown grouped for readability.

Formula and sources

Related calculators