%I #25 May 01 2018 00:08:03
%S 0,0,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
%T 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,
%U 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
%N Least integer k such that (k+1)^k >= n.
%C n -> a(n+1) is a left inverse for A152917 and also, just like n -> a(n)+1, a left inverse to A000169(n) = n^(n-1), with codomain = the positive integers.
%C a(n+1) is also the smallest m such that n can be written with at most m digits in base m+1. For example, the largest number that can be written with 2 digits in base 3 is 8 = 22[3], to write 9 we need to switch to a(9+1) = 3 digits in base 4. Similarly, 63 is the largest number that can be written with a(63+1) = 3 digits in base 4, and from 64 on we need to go to a(64+1) = 4 digits in base 5.
%C There is no doubt that k must be nonnegative, except for the case n = 0, for which we do not want to consider all negative even k which would also satisfy the inequality, and therefore require k >= 0 to get a well defined solution.
%C First occurrence of k = 0, 1, 2, ...: 0, 2, 3, 10, 65, 626, 7777, 117650, ... = A124923. - _Robert G. Wilson v_, Apr 29 2018
%H Robert Israel, <a href="/A303370/b303370.txt">Table of n, a(n) for n = 0..10000</a>
%e (0+1)^0 = 1 >= 0, therefore a(0) = 0.
%e (0+1)^0 = 1 >= 1, therefore a(1) = 0.
%e (0+1)^0 = 1 < 2, but (1+1)^1 = 2 >= 2, therefore a(2) = 1.
%e (1+1)^1 = 2 < 3, but (2+1)^2 = 9 >= 3, therefore a(n) = 2 for 3 <= n <= 9.
%e (2+1)^2 = 9 < 10, but (3+1)^3 = 64 >= 10, therefore a(n) = 3 for 10 <= k <= 64.
%e (3+1)^3 = 64 < 65, but (4+1)^4 = 625 >= 65, therefore a(n) = 4 for 65 <= k <= 625.
%p A:= Array(0..5^4):
%p w:= 0:
%p for k from 0 to 4 do
%p v:= (k+1)^k;
%p A[w..v]:= k;
%p w:= v+1
%p od:
%p seq(A[i],i=0..5^4); # _Robert Israel_, Apr 30 2018
%t f[n_] := Block[{k = 0}, While[(k + 1)^k < n, k++]; k]; Array[f, 105, 0] (* _Robert G. Wilson v_, Apr 29 2018 *)
%o (PARI) a(n,k=ceil(solve(k=0,log(n+1),(k+1)^k-n)))=k-(k&&k^(k-1)>=n) \\ Corrective term in case ceil() incorrectly rounded up.
%Y Cf. A000169, A152917.
%K nonn
%O 0,4
%A _M. F. Hasler_, Apr 26 2018