In mathematics, a harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.
Harshad numbers in base n are also known as n-harshad (or n-Niven) numbers.
Harshad numbers were defined by D. R. Kaprekar, a mathematician from India.[1] The word "harshad" comes from the Sanskritharṣa (joy) + da (give), meaning joy-giver. The term "Niven number" arose from a paper delivered by Ivan M. Niven at a conference on number theory in 1977.
Definition
Stated mathematically, let X be a positive integer with m digits when written in base n, and let the digits be (). (It follows that must be either zero or a positive integer up to .) X can be expressed as
X is a harshad number in base n if:
A number which is a harshad number in every number base is called an all-harshad number, or an all-Niven number. There are only four all-harshad numbers: 1, 2, 4, and 6. The number 12 is a harshad number in all bases except octal.
Examples
The number 18 is a harshad number in base 10, because the sum of the digits 1 and 8 is 9, and 18 is divisible by 9.
The Hardy–Ramanujan number (1729) is a harshad number in base 10, since it is divisible by 19, the sum of its digits (1729 = 19 × 91).
The number 19 is not a harshad number in base 10, because the sum of the digits 1 and 9 is 10, and 19 is not divisible by 10.
In base 10, every natural number expressible in the form 9Rnan, where the number Rn consists of n copies of the single digit 1, n > 0, and an is a positive integer less than 10n and multiple of n, is a harshad number. (R. D’Amico, 2019). The number 9R3a3 = 521478, where R3 = 111, n = 3 and a3 = 3×174 = 522, is a harshad number; in fact, we have: 521478/(5+2+1+4+7+8) = 521478/27 = 19314.[2]
All integers between zero and n are n-harshad numbers.
Properties
Given the divisibility test for 9, one might be tempted to generalize that all numbers divisible by 9 are also harshad numbers. But for the purpose of determining the harshadness of n, the digits of n can only be added up once and n must be divisible by that sum; otherwise, it is not a harshad number. For example, 99 is not a harshad number, since 9 + 9 = 18, and 99 is not divisible by 18.
The base number (and furthermore, its powers) will always be a harshad number in its own base, since it will be represented as "10" and 1 + 0 = 1.
All numbers whose base b digit sum divides b−1 are harshad numbers in base b.
For a prime number to also be a harshad number it must be less than or equal to the base number, otherwise the digits of the prime will add up to a number that is more than 1, but less than the prime, and will not be divisible. For example: 11 is not harshad in base 10 because the sum of its digits “11” is 1 + 1 = 2, and 11 is not divisible by 2; while in base 12 the number 11 may be represented as “B”, the sum of whose digits is also B. Since B is divisible by itself, it is harshad in base 12.
Although the sequence of factorials starts with harshad numbers in base 10, not all factorials are harshad numbers. 432! is the first that is not. (432! has digit sum 3897 = 32 × 433 in base 10, thus not dividing 432!)
Similar to base 10, not all factorials are harshad numbers in base 12. After 7! (= 5040 = 2B00 in base 12, with digit sum 13 in base 12, and 13 does not divide 7!), 1276! is the next that is not. (1276! has digit sum 14201 = 11 × 1291 in base 12, thus does not divide 1276!)
Consecutive harshad numbers
Maximal runs of consecutive harshad numbers
Cooper and Kennedy proved in 1993 that no 21 consecutive integers are all harshad numbers in base 10.[3][4] They also constructed infinitely many 20-tuples of consecutive integers that are all 10-harshad numbers, the smallest of which exceeds 1044363342786.
H. G. Grundman (1994) extended the Cooper and Kennedy result to show that there are 2b but not 2b + 1 consecutive b-harshad numbers for any base b.[4][5]
This result was strengthened to show that there are infinitely many runs of 2b consecutive b-harshad numbers for b = 2 or 3 by T. Cai (1996)[4] and for arbitrary b by Brad Wilson in 1997.[6]
In binary, there are thus infinitely many runs of four consecutive harshad numbers and in ternary infinitely many runs of six.
In general, such maximal sequences run from N·bk − b to N·bk + (b − 1), where b is the base, k is a relatively large power, and N is a constant.
Given one such suitably chosen sequence, we can convert it to a larger one as follows:
Inserting zeroes into N will not change the sequence of digital sums (just as 21, 201 and 2001 are all 10-harshad numbers).
If we insert n zeroes after the first digit, α (worth αbi), we increase the value of N by .
If we can ensure that bn − 1 is divisible by all digit sums in the sequence, then the divisibility by those sums is maintained.
If our initial sequence is chosen so that the digit sums are coprime to b, we can solve bn = 1 modulo all those sums.
If that is not so, but the part of each digit sum not coprime to b divides αbi, then divisibility is still maintained.
(Unproven) The initial sequence is so chosen.
Thus our initial sequence yields an infinite set of solutions.
First runs of exactly n consecutive 10-harshad numbers
The smallest naturals starting runs of exactlyn consecutive 10-harshad numbers (i.e., the smallest x such that are harshad numbers but and are not) are as follows (sequence A060159 in the OEIS):
Every natural number not exceeding one billion is either a harshad number or the sum of two harshad numbers. Conditional to a technical hypothesis on the zeros of certain Dedekind zeta functions, Sanna proved that there exists a positive integer such that every natural number is the sum of at most harshad numbers, that is, the set of harshad numbers is an additive basis.[9]
The number of ways that each natural number 1, 2, 3, ... can be written as sum of two harshad numbers is:
A Nivenmorphic number or harshadmorphic number for a given number base is an integer t such that there exists some harshad number N whose digit sum is t, and t, written in that base, terminates N written in the same base.
For example, 18 is a Nivenmorphic number for base 10:
16218 is a harshad number
16218 has 18 as digit sum
18 terminates 16218
Sandro Boscaro determined that for base 10 all positive integers are Nivenmorphic numbers except 11.[10] In fact, for an even integer n > 1, all positive integers except n+1 are Nivenmorphic numbers for base n, and for an odd integer n > 1, all positive integers are Nivenmorphic numbers for base n. e.g. the Nivenmorphic numbers in base 12 are OEIS: A011760 (all positive integers except 13).
The smallest number with base 10 digit sum n and terminates n written in base 10 are: (0 if no such number exists)
Bloem (2005) defines a multiple harshad number as a harshad number that, when divided by the sum of its digits, produces another harshad number.[11] He states that 6804 is "MHN-4" on the grounds that
(it is not MHN-5 since , but 1 is not "another" harshad number)
and went on to show that 2016502858579884466176 is MHN-12. The number 10080000000000 = 1008 × 1010, which is smaller, is also MHN-12. In general, 1008 × 10n is MHN-(n+2).