A225427 Least Niven number for all bases from 1 to n but not for base n+1.
3, 34, 10, 21, 8, 20, 12, 456, 168, 216, 40, 1764, 24, 432, 2772, 780, 1008, 5640, 720, 88452, 15840, 840, 3360, 14040, 288288, 117600, 338400, 13860, 40320, 6283200, 100800, 2106720, 7698600, 26943840, 19768320, 202799520, 12972960, 242260200, 372556800
Offset: 1
Examples
10 is a Niven number for bases 1 to 3 because in those bases 10 is written as 1111111111, 1010, 101 and the sum of the digits is 10, 2, and 2, which all divide 10.
Links
- Bert Dobbelaere, Table of n, a(n) for n = 1..54 (terms 1..39 from T. D. Noe)
Crossrefs
Cf. A226171 (first base for which n is not a Niven number).
Programs
-
Mathematica
nn = 20; t = Table[0, {nn}]; found = 0; n = 1; While[found < nn, n++; b = 2; While[s = Total[IntegerDigits[n, b]]; s < n && Mod[n, s] == 0, b++]; If[s == n, b = 0]; If[0 < b-1 <= nn && t[[b-1]] == 0, t[[b-1]] = n; found++]]; t
-
PARI
mysumd(n, b) = if (b==1, n, sumdigits(n, b)); isniven(n, b) = (n % mysumd(n, b)) == 0; isok(k, n) = {for (b = 1, n, if (! isniven(k, b), return (0));); ! isniven(k, n+1);} a(n) = {my(k = 1); while (! isok(k, n), k++); k;} \\ Michel Marcus, Oct 09 2018
Comments