login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A066008 Number of n-digit positive integers m for which m/(sum of digits of m) is an integer, sometimes referred to as Niven or Harshad numbers. 3
9, 23, 180, 1325, 10334, 83556, 710667, 6148698, 54619717, 491432596, 4471325309, 40951585117 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Harshad numbers were named by D. Kaprekar; the word "harshad" in Sanskrit means "giving joy." - Harvey P. Dale, Nov 08 2011
LINKS
S. W. Golomb, Sums and products of digits, IEEE Information Theory Society Newsletter, 51 (No. 3, Sept. 2001), p. 15.
PROG
(ARIBAS): function a066008(a, b: integer); var n, c, m, j, k: integer; s: string; begin for n := a to b do c := 0; for m := 10^n to 10^(n+1) - 1 do s := itoa(m); k := 0; for j := 0 to length(s) - 1 do k := k + atoi(s[j..j]); end; if m mod k = 0 then inc(c); end; end; write(c, ", "); end; return; end; a066008(0, 7).
(Python)
def sd(m): return sum(map(int, str(m)))
def is_harshad(m): return m > 0 and m%sd(m) == 0
def a(n): return sum(is_harshad(m) for m in range(10**(n-1), 10**n))
print([a(n) for n in range(1, 7)]) # Michael S. Branicky, Sep 23 2021
CROSSREFS
Sequence in context: A232612 A339439 A266238 * A101058 A247960 A347559
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Dec 11 2001
EXTENSIONS
One more term from Klaus Brockhaus, Dec 12 2001
a(9)-a(12) from Donovan Johnson, Mar 10 2010
Definition expanded by Harvey P. Dale, Nov 08 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 5 06:40 EDT 2024. Contains 372257 sequences. (Running on oeis4.)