A144262 a(n) = smallest k such that k*n is not a Niven (or Harshad) number.
11, 7, 5, 4, 3, 11, 2, 2, 11, 13, 1, 8, 1, 1, 1, 1, 1, 161, 1, 8, 5, 1, 1, 4, 1, 1, 7, 1, 1, 13, 1, 1, 1, 1, 1, 83, 1, 1, 1, 4, 1, 4, 1, 1, 11, 1, 1, 2, 1, 5, 1, 1, 1, 537, 1, 1, 1, 1, 1, 83, 1, 1, 3, 1, 1, 1, 1, 1, 1, 5, 1, 68, 1, 1, 1, 1, 1, 1, 1, 2, 7, 1, 1, 2, 1, 1, 1, 1, 1, 211, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1
Examples
a(2) = 7 since 2, 4, 6, 8, 10 and 12 are all Niven numbers; but 7*2 = 14 is not.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Harshad Number
Crossrefs
Programs
-
Mathematica
a[n_] := Module[{k = 1}, While[Divisible[k*n, Plus @@ IntegerDigits[k*n]], k++]; k]; Array[a, 100] (* Amiram Eldar, Sep 05 2020 *)
-
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
def a(n): kn = n while kn % sum(map(int, str(kn))) == 0: kn += n return kn//n print([a(n) for n in range(1, 100)]) # Michael S. Branicky, Nov 07 2021
Extensions
Edited by Klaus Brockhaus, Sep 19 2008
Comments