login
A273040
Least k >= 2 such that the base-k digits of n are nondecreasing.
2
2, 3, 2, 3, 3, 4, 2, 3, 5, 4, 4, 5, 3, 3, 2, 6, 3, 5, 5, 7, 4, 4, 4, 5, 7, 3, 4, 6, 6, 8, 2, 5, 5, 5, 6, 8, 5, 5, 5, 3, 3, 4, 4, 3, 6, 6, 4, 7, 5, 6, 6, 6, 3, 8, 8, 10, 6, 6, 6, 7, 7, 5, 2, 5, 6, 7, 7, 5, 5, 9, 6, 11, 7, 5, 7, 7, 8, 8, 8, 3, 7, 7, 7, 8, 4
OFFSET
1,1
COMMENTS
a(n) = 2 iff n is in A000225.
a(n) = 3 iff n is in A023745 but not A000225.
a(n) <= floor(n/2)-1 if n > 9.
LINKS
EXAMPLE
a(6) = 4 because 6 is 110 in base 2 and 20 in base 3, which do not have nondecreasing digits, but 12 in base 4 has nondecreasing digits.
MAPLE
F:= proc(n) local k;
for k from 2 do if ListTools:-Sorted(convert(n, base, k), `>`) then return k fi od:
end proc:
map(f, [$1..1000]);
MATHEMATICA
Table[k = 2; While[Sort@ # != # &@ IntegerDigits[n, k], k++]; k, {n, 1, 120}] (* Michael De Vlieger, May 14 2016 *)
lk[n_]:=Module[{k=2}, While[Min[Differences[IntegerDigits[n, k]]]<0, k++]; k]; Array[lk, 90] (* Harvey P. Dale, May 24 2016 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, May 13 2016
STATUS
approved