Fact-checked by Grok 2 weeks ago

Harshad number

A Harshad number, also known as a Niven number, is a positive that is divisible by the of its own digits when written in base 10. The term "Harshad" originates from , combining harṣa (joy) and da (giver), meaning "giver of joy," reflecting its recreational mathematical appeal. The concept was introduced by the Indian Dattatreya Ramchandra Kaprekar in 1955, who also referred to such numbers as "multidigital numbers" in his work on . Independently, the name "Niven number" was coined in 1980 by mathematicians Robert E. Kennedy, Thomas Goodman, and Curtis Best, honoring the Canadian-American number theorist Ivan Niven for his contributions to the field. Harshad numbers form an infinite sequence beginning with 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, and continuing indefinitely, cataloged in the as A005349. These numbers have been studied for their distribution and properties in ; for instance, they have asymptotic zero among all positive integers, meaning the proportion of Harshad numbers up to a large N approaches zero as N grows. Notable results include the fact that no more than 20 consecutive positive integers can all be Harshad numbers, with the longest known such sequence having 44,363,342,786 digits. Generalizations extend to other bases, where an n-Harshad number is divisible by the sum of its digits in base n ≥ 2, and "all-Harshad" numbers—those satisfying the condition in every base ≥ 2—are limited to just 1, 2, 4, and 6.

Definition and History

Definition

A Harshad number in , also known as a b-Niven number, is a positive that is divisible by the sum of its digits in . Formally, n is a Harshad number if s_b(n) divides n, where s_b(n) denotes the sum of the of n. This condition is equivalently expressed as n \equiv 0 \pmod{s_b(n)}. In the conventional base 10, the definition simplifies to n being divisible by the sum of its decimal digits s(n). The digit sum function s_b(n) is computed by expressing n as n = \sum_{k=0}^m d_k b^k with digits $0 \leq d_k < b, and then taking s_b(n) = \sum_{k=0}^m d_k. While iteratively applying s_b to the result yields the digital root of n (a value between 1 and b-1, congruent to n modulo b-1), the Harshad property concerns only the initial . Although 0 has a digit sum of 0 and is sometimes considered trivially Harshad, it is typically excluded from the definition, as Harshad numbers focus on positive integers to avoid division by zero. The divisibility requirement is also stated as n / s_b(n) being an integer.

History and Etymology

The concept of Harshad numbers was first introduced by the Indian mathematician in 1955, under the name "multidigital numbers," in his exploration of intriguing properties of natural numbers. Kaprekar, a prominent figure in recreational mathematics, coined the term "Harshad" from the Sanskrit roots harṣa (joy) and da (giver), literally meaning "joy-giver," reflecting his fascination with numbers that exhibit delightful divisibility patterns. In 1980, the alternative name "Niven numbers" emerged in a paper by Robert E. Kennedy, Terry A. Goodman, and Clarence H. Best, honoring the Canadian-American mathematician for his 1977 conference presentation at the annual Miami University Number Theory Conference, where he discussed problems involving numbers divisible by their digit sums. Kaprekar's contributions, rooted in his broader investigations of number curiosities such as digit rearrangements and self-generating sequences, laid the groundwork for these numbers to transition from recreational puzzles to subjects of formal analysis in number theory.

Examples and Properties

Examples

All single-digit positive integers from 1 to 9 are Harshad numbers in base 10, as each equals the sum of its own digits and is thus divisible by that sum. The sequence of such numbers continues with 10, 12, 18, 20, 21, 24, 27, 30, and many more. To illustrate, consider 18: the sum of its digits is $1 + 8 = 9, and $18 \div 9 = 2, an integer. Similarly, for 24, the digit sum is $2 + 4 = 6, and $24 \div 6 = 4. A more complex example is 162, where $1 + 6 + 2 = 9 and $162 \div 9 = 18. By contrast, 11 is not a Harshad number, since $1 + 1 = 2 and $11 \div 2 = 5.5, which is not an integer. Notably, the calendar years 2022 through 2025 are all Harshad numbers. For 2022, $2 + 0 + 2 + 2 = 6 and $2022 \div 6 = 337; for 2023, $2 + 0 + 2 + 3 = 7 and $2023 \div 7 = 289; for 2024, $2 + 0 + 2 + 4 = 8 and $2024 \div 8 = 253; and for 2025, $2 + 0 + 2 + 5 = 9 and $2025 \div 9 = 225.

Properties

All single-digit positive integers from 1 to 9 are Harshad numbers, as the sum of their digits equals the number itself, which trivially divides it. Similarly, all powers of 10 (i.e., $10^k for positive integers k) are Harshad numbers in base 10, since their decimal representation consists of a 1 followed by k zeros, yielding a digit sum of 1, and 1 divides any integer. The set of Harshad numbers is closed under multiplication by 1 (trivially, as it leaves numbers unchanged), but not generally under addition or multiplication. For instance, 10 and 12 are both Harshad numbers, but their sum 22 has digit sum 4 and $22 \div 4 = 5.5, which is not an integer. Likewise, 8 and 12 are Harshad numbers, but their product 96 has digit sum 15 and $96 \div 15 = 6.4, which is not an integer. If n is a Harshad number and m is a multiple of n such that the digit sum of m equals the digit sum of n, then m is also a Harshad number. This follows from the definition, as s(n) \mid n and n \mid m imply s(n) \mid m, and since s(m) = s(n), it holds that s(m) \mid m. Without preservation of the digit sum, m may or may not be Harshad. A fundamental property linking Harshad numbers to modular arithmetic is their consistency with base-10 congruences modulo 9. For any positive integer n, the sum of its digits satisfies s(n) \equiv n \pmod{9}. If n is Harshad, then n = q \cdot s(n) for some integer q, so substituting the congruence gives n \equiv q \cdot n \pmod{9}, or n(1 - q) \equiv 0 \pmod{9}. This relation is always satisfied for Harshad numbers, confirming the tautological consistency with digital root properties (where the digital root is n \pmod{9}, adjusted to 1–9). Thus, no number can be Harshad unless n \equiv s(n) \pmod{9}, a condition that holds universally but underscores the definitional constraint for divisibility.

Harshad Numbers in Other Bases

Generalization to Other Bases

The concept of a Harshad number extends naturally to arbitrary integer bases b \geq 2. In base b, a positive integer n is called a b-Harshad number (or simply a Harshad number in base b) if n is divisible by the sum of its digits in the base-b representation, denoted s_b(n). This condition is equivalent to n \equiv 0 \pmod{s_b(n)}. For a d-digit number n in base b, the digit sum satisfies $1 \leq s_b(n) \leq d(b-1), since each digit is an integer between 0 and b-1, with the leading digit at least 1. In particular, powers of the base, such as b^k for k \geq 0, are always Harshad numbers in base b, as their representation consists of a 1 followed by k zeros, yielding s_b(b^k) = 1, which divides any integer. For instance, consider the decimal number 18, which is Harshad in base 10 ($18_{10}, digit sum $1+8=9, and $18/9=2). In base 12, however, 18 is represented as $16_{12} (since $1 \times 12 + 6 = 18), with digit sum $1+6=7, and 7 does not divide 18. This illustrates how the Harshad property is base-dependent.

Properties in Different Bases

In any base b > 1, the powers of the base, b^k for k \geq 0, are Harshad numbers because their representation consists of the digit 1 followed by k zeros, yielding a digit sum of 1, by which any is divisible. This holds trivially for all bases, including prime and composite ones, and contributes to the infinite supply of Harshad numbers in each base. For composite bases, the structure of b-1 influences the abundance of Harshad numbers, as any number n whose s_b(n) divides b-1 is automatically Harshad. This follows from the n \equiv s_b(n) \pmod{b-1}, which implies s_b(n) divides n when s_b(n) divides b-1. Bases where b-1 has many divisors thus admit more such numbers; for instance, in base 12 (b-1 = 11, prime, with divisors 1 and 11), the constraint is stricter than in base 10 (b-1 = 9, divisors 1, 3, 9), though empirical counts show similar densities around 9%. Harshad primes in base b are restricted to the single-digit primes (those less than b), as any multi-digit prime p > b cannot be Harshad. For p to be divisible by s_b(p) > 1, s_b(p) would need to equal p, for multi-digit representations where s_b(p) < p; alternatively, s_b(p) = 1 implies p = b^k for k \geq 2, which is composite. The digit sum s_b(n) satisfies the bound s_b(n) \leq (b-1)(\lfloor \log_b n \rfloor + 1) < b \log_b n + b, which limits the possible divisors for Harshad numbers and underscores their relative scarcity for large n. This bound affects divisibility conditions, ensuring s_b(n) remains sublinear in n. In base 2 specifically, Harshad numbers are those where the population count (number of 1-bits) divides n; while powers of 2 satisfy this with population count 1, others exist, such as 6 (binary 110, sum 2, $6/2 = 3). Overall, densities of Harshad numbers tend to be higher in bases where b-1 has more divisors, facilitating more frequent satisfaction of the divisibility criterion.

Consecutive Harshad Numbers

Maximal Runs of Consecutive Harshad Numbers

A run of consecutive Harshad numbers consists of integers m, m+1, \dots, m+k-1 such that each i in this range satisfies i \equiv 0 \pmod{s(i)}, where s(i) denotes the sum of the digits of i in base 10. Early searches identified short runs, such as the length-2 sequence from 2 to 3, where both numbers are divisible by their digit sums of 2 and 3, respectively. Longer runs are constrained by the slow growth of digit sums relative to the numbers themselves, limiting the possible length of such sequences. The maximal length of a run of consecutive Harshad numbers in base 10 is 20. Cooper and Kennedy (1993) proved that no sequence of 21 or more consecutive integers can all be Harshad numbers, relying on modular arithmetic constraints: in any 21 consecutive integers, their residues modulo certain values derived from possible digit sums force at least one non-divisibility. They also demonstrated that runs of exactly 20 occur infinitely often via general constructions. The smallest known explicit run of 20 consecutive Harshad numbers begins at a number with 44,363,342,786 digits (Grundman, 1994). Computational verifications up to $10^{18} have confirmed no runs exceeding length 20.

Runs of Exactly n Consecutive Harshad Numbers

A run of exactly n consecutive Harshad numbers consists of n successive positive integers, each divisible by the sum of its digits in base 10, such that neither the integer immediately preceding the run nor the one following it is Harshad. These runs are of interest because they highlight the sporadic clustering of Harshad numbers, with the smallest such runs providing benchmarks for their distribution. The sequence of the smallest starting points for these runs, denoted a(n), is cataloged in OEIS A060159. For small n, these starting points are relatively modest, but they grow rapidly as n increases, reflecting the increasing rarity of long exact runs. The following table lists the smallest starting points for n from 1 to 10, along with representative examples of the runs:
nStarting point a(n)Example run
11212
22020, 21
3110110, 111, 112
4510510 to 513
5131052131052 to 131056
61275122012751220 to 12751225
71000009510000095 to 10000101
821620491502162049150 to 2162049157
9124324220124324220 to 124324228
1011 to 10
These values are derived from computational searches and verified in the literature on Harshad numbers. For larger n, the starting points become extraordinarily large. For instance, the smallest run of exactly 20 consecutive Harshad numbers begins at a number with 44,363,342,786 digits. Such extended exact runs are exceedingly rare, with the precise locations for n up to 14, and select higher values like 16 and 17, documented in OEIS A060159, underscoring the challenges in locating them beyond small n.

Density and Additive Properties

Estimating the Density of Harshad Numbers

The set of Harshad numbers has natural density zero. Although the natural density is zero, more precise estimates for the counting function N(x), which denotes the number of Harshad numbers not exceeding x, have been established. In particular, de Koninck, Doyon, and Kátai proved that N(x) = \left( c + o(1) \right) \frac{x}{\log x} as x \to \infty, where c = \frac{14}{27} \log 10 \approx 1.1939. This asymptotic indicates that the proportion of Harshad numbers up to x decreases like c / \log x, reflecting slower-than-polynomial but sublinear growth in the count. A probabilistic heuristic supports this form. For a typical integer n \approx x, the sum of its base-10 digits s(n) has expectation \frac{9}{2} (\log_{10} x + 1) \approx \frac{9}{2} \log_{10} x. The condition s(n) \mid n holds with probability roughly $1/s(n) under a uniform residue assumption modulo s(n), yielding an overall proportion on the order of $1 / \log x. Refinements accounting for the distribution of s(n) lead to the constant c in the asymptotic. Empirically, the proportion decreases gradually; for instance, approximately 9.25% of positive integers up to $10^6 are Harshad numbers (92,481 such numbers).

Sums of Harshad Numbers

Harshad numbers possess notable additive properties that allow them to form an additive basis for the natural numbers. Computational results demonstrate that every natural number up to $10^9 is either a Harshad number or the sum of two Harshad numbers. This verification was achieved through exhaustive enumeration, confirming no exceptions within this range. Under the assumption of Hooley's Riemann Hypothesis, the set of base-10 Harshad numbers forms a finite additive basis, meaning there exists a constant C such that every natural number is the sum of at most C Harshad numbers. More recently, it has been established unconditionally that, for any base g \geq 3, the base-g Harshad numbers form an asymptotic additive basis of order 3: every sufficiently large natural number can be expressed as the sum of at most three such numbers. The partial sums of the first k base-10 exhibit asymptotic growth on the order of k^2 \log k, arising from the inverse relation to their counting function, which grows like x / \log x. Representations of integers as sums of Harshad numbers can leverage greedy strategies, iteratively subtracting the largest possible Harshad number from the remainder until the target is reached, though the minimal number of terms remains bounded by the basis order.

Advanced Concepts

Nivenmorphic Numbers

A nivenmorphic number, also known as a harshadmorphic number, in base b is a positive integer t for which there exists a base-b N such that the sum of the base-b digits of N, denoted s_b(N), equals t, and the base-b representation of N ends with the base-b digits of t. This implies that N can be obtained by prepending one or more digits to the base-b representation of t. Since N is a , it is divisible by s_b(N) = t, making N a multiple of t. The concept refines by requiring the terminating digits to match the digit sum exactly. For example, in base 10, 18 is nivenmorphic because 16218 is a Harshad number with s_{10}(16218) = 1 + 6 + 2 + 1 + 8 = 18, and 16218 ends with the digits 18; moreover, $16218 \div 18 = 901. Similarly, 16 is nivenmorphic because 3616 is a Harshad number with digit sum 16 ($3 + 6 + 1 + 6 = 16), ends with 16, and $3616 \div 16 = 226. In base 10, every positive integer is nivenmorphic except for 11, as determined by exhaustive checks showing no such N exists for t = 11. This exception arises because no multiple of 11 formed by prepending digits to 11 yields a digit sum of 11 while satisfying the Harshad condition. The sequence of the smallest such N for each t (with 0 indicating impossibility) is given in OEIS A075154. The property generalizes to arbitrary bases b \geq 2, where the set of nivenmorphic numbers depends on b, and exceptions, if any, are finite and base-specific. To construct a nivenmorphic number t (when possible), prepend digits to the base-b representation of t such that the resulting number N has digit sum t and N is divisible by t; for non-exceptions like t \neq 11 in base 10, such prependings always exist, often found by solving for digits that adjust the sum and ensure divisibility.

Multiple Harshad Numbers

A multiple Harshad number is a Harshad number that, when divided by the sum of its digits, produces another Harshad number. This process can be iterated: a k-multiple Harshad number requires that k successive divisions by the digit sum of the current number each yield a Harshad number. When k=1, it reduces to a standard Harshad number. For larger k, stricter conditions apply. For instance, 36 is a multiple Harshad number: digit sum 9 (3+6=9), 36 ÷ 9 = 4, and 4 is Harshad (sum 4, 4 ÷ 4 = 1). Another example is 81: digit sum 9 (8+1=9), 81 ÷ 9 = 9, and 9 is Harshad. Further division 9 ÷ 9 = 1, which is Harshad, making 81 a 2-multiple Harshad number. Multiple Harshad numbers for k>1 form a proper subset of Harshad numbers due to the additional constraints; their asymptotic density decreases with increasing k.

References

  1. [1]
    Harshad Number -- from Wolfram MathWorld
    A positive integer which is divisible by the sum of its digits, also called a Niven number (Kennedy et al. 1980) or a multidigital number (Kaprekar 1955).
  2. [2]
    A005349 - OEIS
    Named "Harshad numbers" by the Indian recreational mathematician Dattatreya Ramchandra Kaprekar (1905-1986) in 1955. The meaning of the word is "giving joy" in ...
  3. [3]
    [PDF] arXiv:1807.02573v1 [math.NT] 6 Jul 2018
    Jul 6, 2018 · Niven (or Harshad) numbers are numbers divisible by the sum of their dec- imal digits. Niven numbers have been extensively studied. See for ...<|control11|><|separator|>
  4. [4]
    Harshad Numbers and Sage Programming - SLMath
    A Harshad number is a positive integer that is divisible by the sum of its digits. The word “Harshad” comes from the Sanskrit harsa (joy) + da (give), ...
  5. [5]
    D R Kaprekar (1905 - 1986) - Biography - MacTutor
    DR Kaprekar was born in Dahanu, a town on the west coast of India about 100 km north of Mumbai. He was brought up by his father after his mother died when he ...<|control11|><|separator|>
  6. [6]
    Harshad Years – Archimedes Lab Project
    Jan 5, 2023 · Harshad number is defined as an integer that is divisible by the sum of its digits. Interestingly, the years 2022-2025 are Harshad numbers.
  7. [7]
    [PDF] Infinite Sets of b-Additive and b-Multiplicative Ramanujan-Hardy ...
    May 24, 2019 · We observe that a trivial example of infinitely many b-MRH numbers is given by the powers of 10. Our examples have at least two digits ...
  8. [8]
    Harshad numbers - OeisWiki
    Sep 6, 2017 · Single digit numbers are trivially Harshad numbers, and in fact ... A005349. 11, 12, 15, 20, 22, 24, 25, 30, 33, 35, 36, 40, 44, 45, 48 ...
  9. [9]
    [PDF] Harshad Numbers - CoCalc
    b-Harshad Numbers. Definition. For b ≥ 2, a b-Harshad number is a positive integer that is divisible by the sum of the digits in its base b expansion.
  10. [10]
    Harshad number - Dozenal Wiki - Fandom
    A Harshad number is an integer divisible by the sum of its digits when written in a given base. For example, 134 is a Harshad number.
  11. [11]
    [PDF] About Some Relatives of the Taxicab Number - arXiv
    Nov 3, 2018 · In what follows let b ≥ 2 be an arbitrary numeration base. ... Bloem, Harshad numbers, J. Rec. Math., 34 (2005), 128. [3] T. Cai, On 2 ...
  12. [12]
  13. [13]
    [PDF] On consecutive Niven numbers - The Fibonacci Quarterly
    "Mathematical Discovery and Niven Numbers." The. MATYC Journal 14 (1980):21-25. 2. R. Kennedy. "Digital Sums, Niven Numbers, and Natural Density.".
  14. [14]
    A060159 - OEIS
    - **Sequence Definition**: a(n) = initial term of the smallest tuple of exactly n consecutive Harshad numbers (numbers divisible by the sum of their digits).
  15. [15]
    Puzzle 129. Earliest sets of K consecutive Harshad Numbers
    Furthermore, since S is the digit sum of S, N=S (mod 9), so 9 also divides N-S. To search for such a cluster, choose S and define L=lcm(9,S,S+1,S+2,S+ ...
  16. [16]
    On the Natural Density of the Niven Numbers
    On the Natural Density of the Niven Numbers. Robert E. Kennedy. Curtis N. Cooper. Robert E. Kennedy has been at Central Missouri State Uni- versity since 1967 ...
  17. [17]
    On the counting function for the Niven numbers - Academia.edu
    Niven numbers are defined by divisibility by the sum of their decimal digits. The set of Niven numbers has zero density established by Kennedy and Cooper in ...<|control11|><|separator|>
  18. [18]
    [2101.07593] Additive bases and Niven numbers - arXiv
    Jan 19, 2021 · View a PDF of the paper titled Additive bases and Niven numbers, by Carlo Sanna ... number is the sum of at most C_g base-g Niven numbers.Missing: Harshad | Show results with:Harshad
  19. [19]
  20. [20]
    A075154 - OEIS
    Sandro Boscaro, Nivenmorphic Integers, Journal of Recreational Mathematics, Vol. 28 (1996-97), Number 3, pp. 201-205. LINKS. Sean A. Irvine, Table of n, a(n) ...
  21. [21]
    A011760 - OEIS
    Index entries for linear recurrences with constant coefficients, signature (2,-1). FORMULA a(n) = n + sign( floor( n/13 ) ).
  22. [22]
    (PDF) Positive Numbers Divisible by their Iterative Digit Sum Revisited
    Jun 6, 2017 · ... Harshad numbers are positive integers. divisible by the sum of their digit. Comparison is. important to compare divisibility by sum of digit.