Skip to content

HarshadNumbers ​

The Harshad (Niven) numbers 1,2,3,…,10,12,18,…1, 2, 3, …, 10, 12, 18, …: integers divisible by their own digit sum.

HarshadNumbersthe nn with n mod digitSum(n)=0n \bmod \mathrm{digitSum}(n) = 0, an infinite indexed collection.

Domain: Collections

Details
  • A lazy indexed collection: Count(HarshadNumbers)=+∞Count(HarshadNumbers) = +\infty -- every digit-sum-1 number (a power of 10) qualifies, so the family never thins out. OEIS A005349.
  • At(HarshadNumbers,k)At(HarshadNumbers, k) unranks by scanning forward from the last cached match -- At(HarshadNumbers,11)=12At(HarshadNumbers, 11) = 12.
  • Membership goes through Element: Element(18,HarshadNumbers)Element(18, HarshadNumbers) is true (digit sum 9, 18/9=218/9=2), Element(11,HarshadNumbers)Element(11, HarshadNumbers) is false.

Enumeration

Examples

1 more kept as data, checked against the oracles
About
Examples1
CrosswalkOEIS

See also: Count, At, Element, HappyNumbers, SmithNumbers