A115353 The mode of the digits of n (using smallest mode if multimodal).
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 0, 1, 2, 3, 4, 5, 5, 5, 5, 5, 0, 1, 2, 3, 4, 5, 6, 6, 6, 6, 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 0, 0, 0
Offset: 0
Examples
a(12)=1 because 1, 2, the digits of 12, each occur the same number of times and 1 is the smaller of the two modes. a(101)=1 because 1 is the unique mode of 1, 0, 1 (occurring twice while 0 appears only once).
Links
- Bence BernĂ¡th, Table of n, a(n) for n = 0..10000
Crossrefs
Cf. A054054 (Smallest digit of n).
Programs
-
MATLAB
function nth_term=A115353(n) nth_term=mode((num2str(n)-'0')); end sequence = arrayfun(@A115353, linspace(0,105,106)) % Bence BernĂ¡th, Jan 06 2023
-
Mathematica
a[n_] := Min[Commonest[IntegerDigits[n]]]; Array[a,105,0] (* Stefano Spezia, Jan 08 2023 *)
-
Python
from statistics import mode def a(n): return int(mode(sorted(str(n)))) print([a(n) for n in range(105)]) # Michael S. Branicky, Jan 08 2023
Comments