OFFSET
1,1
COMMENTS
a(n) <= n-1 for n > 2 (since k > 1).
This is also the least number k such that (k^n-n^k)/(k-n) is an integer.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
(2^2-5^5)/(2-5) = 3121/3 is not an integer. (3^3-5^5)/(3-5) = 3098/2 = 1549 is an integer. Thus a(5) = 3.
MAPLE
A242872:= proc(n)
local nn, k;
nn:= n^n;
for k from 2 to n-1 do
if (nn-k^k) mod (n-k) = 0 then return k fi
od;
return n+1;
end:
seq(A242872(n), n=1..100); # Robert Israel, May 25 2014
MATHEMATICA
a[n_] := Switch[n, 1, 2, 2, 3, _, With[{nn = n^n}, For[k = 2, True, k++, If[Mod[nn-k^k, n-k] == 0, Return[k]]]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 15 2023 *)
PROG
(PARI) a(n)=for(k=2, n+1, if(k!=n, s=(k^k-n^n)/(k-n); if(floor(s)==s, return(k))));
n=1; while(n<100, print(a(n)); n+=1)
CROSSREFS
KEYWORD
nonn
AUTHOR
Derek Orr, May 24 2014
STATUS
approved