A226171 Smallest base in which n is not Niven (or zero if n is Niven in every base).
0, 0, 2, 0, 2, 0, 2, 6, 2, 4, 2, 8, 2, 2, 2, 6, 2, 8, 2, 7, 5, 2, 2, 14, 2, 2, 2, 2, 2, 2, 2, 6, 2, 3, 2, 8, 2, 2, 2, 12, 2, 3, 2, 2, 2, 2, 2, 14, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 8, 2, 2, 2, 6, 2, 3, 2, 3, 3, 2, 2, 14, 2, 2, 2, 2, 2, 2, 2, 8, 5, 2, 2, 5, 2, 2
Offset: 1
Examples
The sum of digits of 24 in bases 1 through 14 are: 24, 2, 4, 3, 8, 4, 6, 3, 8, 6, 4, 2, 12, 11. 24 is divisible by all these numbers except the last one; therefore a(24) = 14.
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
Table[b = 2; While[s = Total[IntegerDigits[n, b]]; s < n && Mod[n, s] == 0, b++]; If[s == n, b = 0]; b, {n, 100}] (* T. D. Noe, May 30 2013 *)
-
PARI
a(n) = {for (b=2, n-1, if (frac(n/sumdigits(n,b)), return(b));); 0;} \\ Michel Marcus, Oct 23 2018
Comments