login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Least k >= 2 such that the base-k digits of n are nondecreasing.
2

%I #14 May 24 2016 11:08:55

%S 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,

%T 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,

%U 5,9,6,11,7,5,7,7,8,8,8,3,7,7,7,8,4

%N Least k >= 2 such that the base-k digits of n are nondecreasing.

%C a(n) = 2 iff n is in A000225.

%C a(n) = 3 iff n is in A023745 but not A000225.

%C a(n) <= floor(n/2)-1 if n > 9.

%H Robert Israel, <a href="/A273040/b273040.txt">Table of n, a(n) for n = 1..10000</a>

%e 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.

%p F:= proc(n) local k;

%p for k from 2 do if ListTools:-Sorted(convert(n,base,k),`>`) then return k fi od:

%p end proc:

%p map(f, [$1..1000]);

%t Table[k = 2; While[Sort@ # != # &@ IntegerDigits[n, k], k++]; k, {n, 1, 120}] (* _Michael De Vlieger_, May 14 2016 *)

%t lk[n_]:=Module[{k=2},While[Min[Differences[IntegerDigits[n,k]]]<0,k++]; k]; Array[lk,90] (* _Harvey P. Dale_, May 24 2016 *)

%Y Cf. A000225, A009994, A023745 to A023757.

%K nonn,base

%O 1,1

%A _Robert Israel_, May 13 2016