A144261 a(n) = smallest k such that k*n is a Niven (or Harshad) number.
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 9, 3, 2, 3, 6, 1, 6, 1, 1, 5, 9, 1, 2, 6, 1, 3, 9, 1, 12, 6, 4, 3, 2, 1, 3, 3, 3, 1, 10, 1, 12, 3, 1, 5, 9, 1, 8, 1, 2, 3, 18, 1, 2, 2, 2, 9, 9, 1, 12, 6, 1, 3, 3, 2, 3, 3, 3, 1, 18, 1, 7, 3, 2, 2, 4, 2, 9, 1, 1, 5, 18, 1, 6, 6, 3, 3, 9, 1, 4, 5, 4, 9, 2, 2, 12, 4, 2, 1
Offset: 1
Examples
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).
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
Crossrefs
Programs
-
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 *)
-
PARI
digitsum(n) = {local(s=0); while(n, s+=n%10; n\=10); s} {for(n=1, 100, k=1; while((p=k*n)%digitsum(p)>0, k++); print1(k, ","))} /* 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
Extensions
Edited and extended by Klaus Brockhaus, Sep 19 2008
Comments