cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A225427 Least Niven number for all bases from 1 to n but not for base n+1.

Original entry on oeis.org

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

Views

Author

T. D. Noe, May 30 2013

Keywords

Comments

A number m is a Niven number in base b if the sum of its base-b digits divides m. The number 1 is a Niven number in all bases.
Note that in most cases, especially as n becomes larger, these are fairly round numbers. For instance, a(39) = 2^10 * 3^3 * 5^2 * 7^2 * 11.

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.
		

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