cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A066008 #18 Sep 23 2021 11:24:57
%S A066008 9,23,180,1325,10334,83556,710667,6148698,54619717,491432596,
%T A066008 4471325309,40951585117
%N 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.
%C A066008 Harshad numbers were named by D. Kaprekar; the word "harshad" in Sanskrit means "giving joy." - _Harvey P. Dale_, Nov 08 2011
%H A066008 S. W. Golomb, <a href="https://www.itsoc.org/sites/default/files/2021-03/itNL0901.pdf">Sums and products of digits</a>, IEEE Information Theory Society Newsletter, 51 (No. 3, Sept. 2001), p. 15.
%o A066008 (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).
%o A066008 (Python)
%o A066008 def sd(m): return sum(map(int, str(m)))
%o A066008 def is_harshad(m): return m > 0 and m%sd(m) == 0
%o A066008 def a(n): return sum(is_harshad(m) for m in range(10**(n-1), 10**n))
%o A066008 print([a(n) for n in range(1, 7)]) # _Michael S. Branicky_, Sep 23 2021
%Y A066008 Cf. A007953, A034726, A034727.
%K A066008 nonn,base
%O A066008 1,1
%A A066008 _N. J. A. Sloane_, Dec 11 2001
%E A066008 One more term from _Klaus Brockhaus_, Dec 12 2001
%E A066008 a(9)-a(12) from _Donovan Johnson_, Mar 10 2010
%E A066008 Definition expanded by _Harvey P. Dale_, Nov 08 2011