login
a(n) is the smallest m such that A144261(m) = n.
1

%I #26 Nov 04 2022 10:48:15

%S 1,15,14,33,22,17,73,49,13,11,529,31,397,293,241,199,1633,53,3727,761,

%T 331,491,4343,431,1943,887,383,3659,3809,377,15863,9419,2713,2993,

%U 26753,1583,30311,5297,8971,2753,5363,983,11603,4919,18314,14657,59303,1499,99179

%N a(n) is the smallest m such that A144261(m) = n.

%C In other words, a(n) is the smallest element m of the set of the integers k that satisfy {A144261(k) = n and n * k is a Niven number} (see Example section).

%C Same question as in A144261: does a(n) exist for all n?

%H Giovanni Resta, <a href="https://www.numbersaplenty.com/set/Harshad_number/">Harshad numbers</a>.

%e 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.

%t 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 *)

%o (PARI) f(n) = my(k=1); while ((k*n) % sumdigits(k*n), k++); k; \\ A144261

%o a(n) = my(k=1); while (f(k) != n, k++); k; \\ _Michel Marcus_, Oct 31 2022

%o (Python)

%o from itertools import count

%o 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

%Y Cf. A005349 (Niven numbers), A144261.

%K nonn,base

%O 1,2

%A _Bernard Schott_, Oct 29 2022

%E More terms from _Amiram Eldar_, Oct 29 2022