OFFSET
1,11
COMMENTS
Niven (or Harshad) numbers are numbers that are divisible by the sum of their digits.
Does a(n) exist for all n? - Klaus Brockhaus, Sep 19 2008
The answer is yes, see the Radcliffe link. - M. F. Hasler, Oct 16 2025
LINKS
David Radcliffe, Table of n, a(n) for n = 1..10000
David Radcliffe, Every positive integer divides a Harshad number
Eric Weisstein's World of Mathematics, Harshad Number
EXAMPLE
a(14) = 3 since neither 1*14 or 2*14 are Niven numbers, but 3*14 = 42 is a Niven number: 42 = 7*(4+2).
MATHEMATICA
niv[n_]:=Module[{k=1}, While[!Divisible[k*n, Total[IntegerDigits[ k*n]]], k++]; k]; Array[niv, 100] (* Harvey P. Dale, Jul 23 2016 *)
PROG
(PARI) apply( {A144261(n)=for(k=1, oo, is_A005349(k*n)&&return(k))}, [1..99]) \\ M. F. Hasler, Oct 16 2025, replacing older code from Klaus Brockhaus, Sep 19 2008
(Python)
from itertools import count
def A144261(n): return next(filter(lambda k:not (m:=k*n) % sum(int(d) for d in str(m)), count(1))) # Chai Wah Wu, Nov 04 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Sergio Pimentel, Sep 16 2008
EXTENSIONS
Edited and extended by Klaus Brockhaus, Sep 19 2008
STATUS
approved
