OFFSET
1,2
COMMENTS
Niven numbers are also known as harshad numbers. - Harvey P. Dale, May 20 2021
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Jean-Marie De Koninck and Nicolas Doyon, Large and Small Gaps Between Consecutive Niven Numbers, J. Integer Seqs., Vol. 6, 2003, Article 03.2.5.
FORMULA
a(n) = (c+o(1))*n/log(n) where c = 14/27*log(10) = 1.1939330111820977620834029765030036632....
MATHEMATICA
Accumulate[Table[If[Divisible[n, Total[IntegerDigits[n]]], 1, 0], {n, 80}]] (* Harvey P. Dale, May 20 2021 *)
PROG
(PARI)
s(k)=if(k<1, 0, if(k%10, s(k-1)+1, s(k/10)));
a(n)=sum(k=1, n, if(k%s(k), 0, 1));
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Benoit Cloitre, Jul 28 2003
STATUS
approved