Harshad (Niven) Number Checker
Enter a positive integer to test the Harshad property and see the digit sum.
Result
How it is calculated
The tool writes the number as text, adds its decimal digits, and tests whether the number divides by that sum with no remainder: n mod S = 0, where n is the number and S is its digit sum. If it does, the answer is Yes and the quotient n ÷ S is shown; if not, the answer is No and the quotient shows a dash. For example 19 has digit sum 10, and 19 does not divide by 10, so it fails. Only positive whole numbers up to 1015 are accepted. Zero, negative numbers, decimals such as 12.5, numbers above 1015 and input with a thousands separator give no result. The test is done in base 10; a number can be a Harshad number in one base and not in another. Plain integer arithmetic is used, so large inputs are exact.
Worked example
Test 2024. Digits: 2 + 0 + 2 + 4 = 8, so the digit sum is 8. Now divide: 2024 ÷ 8 = 253, a whole number with no remainder. The answer is Yes, the digit sum is 8 and the quotient is 253. So 2024 is a Harshad number. For comparison, 2023 has digit sum 7 and 2023 ÷ 7 = 289 exactly, so it passes as well, while 2022 has digit sum 6 and also divides (337).
Common mistakes
- Dividing by the number of digits instead of their sum. For 2024 the divisor is 8 (the sum), not 4 (the count).
- Entering a number with a decimal part, a minus sign or a thousands separator. Only plain positive whole numbers work, and the tool shows nothing for 12.5, −18 or 2,024.
- Typing 0 as a trivial case. Zero is not accepted, because the digit sum would also be 0 and the division has no meaning.
- Reading the quotient dash as an error. A dash simply means the number is not a Harshad number, so there is no whole quotient.
- Assuming a number that fails here is a Harshad number in no number system. The check is in base 10 only.
About this calculator
A Harshad number — also called a Niven number — is a positive integer that is evenly divisible by the sum of its own digits. For example, 18 has digit sum 1+8=9, and 18÷9=2 with no remainder, so 18 qualifies. The name comes from Sanskrit, roughly ‘great joy,’ coined by the mathematician D. R. Kaprekar; ‘Niven number’ honors Ivan Niven, who wrote about the same property. Every number from 1 to 9 is trivially a Harshad number since a single digit always divides itself.
Harshad numbers are a staple of recreational number theory: they show up in puzzle collections, programming katas that ask you to test divisibility rules, and sequences studied on OEIS. Runs of consecutive Harshad numbers get rarer as numbers grow, which makes finding long unbroken chains an interesting computational challenge, and some coding exercises use Harshad-style digit-sum checks as a simple divisibility filter before more expensive primality or factoring tests.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments