Find the largest value of power.
Golfscript - 26 chars
~:x,{:b;x,{b?x=b*}%+}*$-1>
Rough translation to Python
x=input()
acc = []
for b in range(x):
for _ in range(x):
acc.append((_**b==x)*b) # most of these are zeros
print max(acc)
So it loops way more times that necessary, but that often happens with golfed answers
APL (Dyalog Extended), 13 bytes
⌈/⍳×∘(⊢=⌊)⍳√⊢
Try it online!
⌈/⍳×∘(⊢=⌊)⍳√⊢ Monadic train taking an input n:
⍳√⊢ Get the 1st, ..., nth roots of n.
(⊢=⌊) Find whether each element equals its floor; i.e. is an integer.
Returns a list of 0s and 1s.
⍳ List of 1, ..., n
× Multiply that with the binary list.
Now we have a list starting with 1 (since the 1st root of n is n, an integer)
and larger nonzero values corresponding to the other roots that are integers.
⌈/ Find the maximum.
Haskell, 63 56 characters
Handles ℤ>0 (56 characters)
main=do n<-readLn;print$last[p|p<-[0..n],b<-[0..n],b^p==n]
Handles ℤ≥0 (58 characters)
main=do n<-readLn;print$last[p|p<-[0..n+1],b<-[0..n],b^p==n]
Handles ℤ (70 characters)
main=do n<-readLn;print$last[p|p<-[0..abs n+1],b<-[n..0]++[0..n],b^p==n]