OFFSET
1,2
COMMENTS
LINKS
Giovanni Resta, Harshad numbers.
EXAMPLE
A144261(15) = A144261(25) = A144261(35) = A144261(51) = ... = 2 because 15, 25, 35, 51, ... are not Niven numbers and 2 is the smallest integer such that 2*15=30, 2*25=50, 2*35=70, 2*51=102, ..., are Niven (or Harshad) numbers. Since 15 is the least integer that, when multiplied by 2, yields a Niven number (2*15), a(2) = 15.
MATHEMATICA
f[n_] := Module[{k = 1, p}, While[! Divisible[p = k*n, Plus @@ IntegerDigits[p]], k++]; k]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i}, While[c < len && n < nmax, i = f[n]; If[i <= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[50, 10^6] (* Amiram Eldar, Oct 29 2022 *)
PROG
(PARI) f(n) = my(k=1); while ((k*n) % sumdigits(k*n), k++); k; \\ A144261
a(n) = my(k=1); while (f(k) != n, k++); k; \\ Michel Marcus, Oct 31 2022
(Python)
from itertools import count
def A358067(n): return next(filter(lambda m:n==next(filter(lambda k:not (r:=k*m) % sum(int(d) for d in str(r)), count(1))), count(1))) # Chai Wah Wu, Nov 04 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Oct 29 2022
EXTENSIONS
More terms from Amiram Eldar, Oct 29 2022
STATUS
approved