A190592 Maximal digit in base-3 expansion of n.
0, 1, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 0
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Programs
-
Maple
[seq(max(convert(n,base,3)),n=0..120)];
-
Mathematica
Join[{0}, gl[n_] := Module[{idn = IntegerDigits[n, 3]}, Max[idn]]; Array[gl,100]] (* Vincenzo Librandi, Aug 12 2017 *)
-
PARI
a(n) = if (n==0, 0, vecmax(digits(n, 3))); \\ Michel Marcus, Aug 12 2017
Formula
a(n) = 2 if n == 2 (mod 3), a(1)=1, otherwise a(n) = a(floor(n/3)). - Robert Israel, Aug 11 2017