Problem:
 Score : 200 points    Problem Statement You are given a positive integer X .
Find the largest perfect power that is at most X .
Here, a perfect power is an integer that can be represented as b^p , where b is an integer not less than 1 and p is an integer not less than 2 .      Constraints  1  ≤  X  ≤  1000  X is an integer.         Input Input is given from Standard Input in the following format:  X       Output Print the largest perfect power that is at most X .        Sample Input 1 10      Sample Output 1 9  There are four perfect powers that are at most 10 : 1 , 4 , 8 and 9 .
We should print the largest among them, 9 .       Sample Input 2 1      Sample Output 2 1       Sample Input 3 999      Sample Output 3 961

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

x = ni()
max = 1
a = [2,3,4,5,6,7,8,9]

for i in range(1, x+1):
    for j in a:
        if i**j <= x and i**j > max:
            max = i**j
print(max)

Solution (Python):
x = int(input())
m =0
for i in range(2,11):
    m=max(m,int(((x**(1/i)+0.000001)//1)**i))
print(m)

Solution (Python):
X = int(input())
a = []

for i in range(1,32):
    for j in range(2,10):
        if i**j <= 1000:
            a.append(i**j)
a_uni = list(set(a))
b = sorted(a_uni)
    
max = 0
for i in b:
    if i <= X:
        max = i
print(max)

Solution (Python):
x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        if (i**j<=x):
            beki.append(i**j)
print(max(beki))

Solution (Python):
candidate = []

for i in range(32):
    if i >= 1:
        for j in range(32):
            if i**j <= 1000:
                if j > 1:
                    if i**j not in candidate:
                        candidate.append(i**j)
            else:
                break

candidate = sorted(candidate)
x = int(input())
result = 1
for c in candidate[1:]:
    if x >= c:
        result = c
    else:
        break
print(result)

Solution (Python):
X = int(input())

numberOfPowers = set([1])

for i in range(2, 33):
    j = 2
    while True:
        numberOfPowers.add(i**j)
        j += 1
        if (i ** j > 1000):
            break

ans = 0
for i in sorted(numberOfPowers):
    if i > X:
        break
    ans = i

print(ans)

Solution (Python):
n = int(input())
res = 1
for i in range(1, n):
    for j in range(1, n):
        if i**j > n:
            if res < i**(j-1):
                res = i ** (j-1)
            break
    if i**2 > n:
        break
print(res)

Solution (Python):
X = int(input())
b=1
MAX=1
if X!=1:
    while b<X/2:
        p=2
        b+=1
        while b**p <= X:
            if b**p > MAX:
                MAX = b**p
            p+=1
print(MAX)

Solution (Python):
import sys
X = int(input())

lim = int(X**(1/2))

listx =[]

if X == 1 or X == 2 or X ==3:
    print(1)
    sys.exit()

if X >= 4 and X <= 8:
    print(4)
    sys.exit()

for i in range(lim+1):
    if i == 0 or i ==1:
        continue
    a = i
    p = 0
    while a <= X:
        a = i ** p
        p += 1
    listx.append(i**(p-2))

print(max(listx))

Solution (Python):
X = int(input())
max_fs = 1

for x in range(2, X + 1):
    for p in range(2, 10):
        if x ** p <= X:
            max_fs = max(max_fs, x ** p)
        else:
            break
print(max_fs)

Solution (Python):
import math

X=int(input())

y=math.floor(math.sqrt(X))

L=[0 for i in range(y+1)]

for i in range(2,y+1):
    count=1
    while True:
        n=i**count
        if n<=X:
            count+=1
        else:
            break
    L[i]=i**(count-1)

if X<=3:
    print(1)
else:
    print(max(L))

Solution (Python):
X = int(input())

exponential = {1}
for i in range(2, 32):
    for j in range(2, 11):
        if i ** j <= X:
            exponential.add(i ** j)
        else:
            break
print(max(exponential))

Solution (Python):
import math
n=int(input())

k=pow(n,0.5)
ans=1
if(n<=3):
	print(1)
else:
	ans=-1
	for i in range(1,n+1):
		for j in range(2,n+1):
			if(pow(i,j)<=n):
				if(ans<pow(i,j)):
					ans=pow(i,j)
				
			else:
				break
	print(ans)

Solution (Python):
import math
x = int(input())
r = [1]
for y in range(2, int(math.sqrt(x)) + 1):
    z = 2
    tmp = 1
    while math.pow(y, z) <= x:
        tmp = int(math.pow(y, z))
        z += 1
    r.append(tmp)
print(max(r))

Solution (Python):
x = int(input())
ans = 0
for i in range(x, 0, -1):
    if i == 1:
        ans = 1
        break
    tmp = i
    for j in range(31, 1 ,-1):
        i = tmp
        
        flag = 0
        while(i > 1):
            i = i/j
            flag += 1
            if i == 1 and flag > 1:
                ans = tmp
                break
        if ans != 0:
            break
    if ans != 0:
        break
print(ans)

Solution (Python):
X = int(input())
ans = 0

if X < 2**2:
  print(1)
  exit()
  
for b in range(2, 32):
    p = 2
    if b ** p > X:
      continue
    while b ** (p+1) <= X:
        p += 1
    ans = max(ans, b**p)

print(ans)

Solution (Python):
x = int(input())
l = sorted(set([x ** y for y in range(2,20) for x in range(1,100) if x**y <= 1000]))

print(max([n for n in l if n <= x]))

Solution (Python):
x = int(input())
max = 0
if x == 1:
    print(1)
    exit()
for b in range(1, 1001):
    for p in range(2, 10):
        if b**p <= x:
            if b**p >= max:
                max = b**p
print(max)

Solution (Python):
X = int(input())

max_val = 0

if X == 1:
    max_val = 1

for b in range(2,X):
    p = 2
    while(True):
        val = b ** p
        if val > X:
            break
        if val >= max_val:
            max_val = val
        p += 1

print(max_val)

Solution (Python):
import sys
import math
if __name__ == "__main__":
    X = int(input())
    buf = int(math.sqrt(X))
    buf = pow(buf, 2)
    for i in range(2, 11):
        tmp = pow(i, 3)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(2, 6):
        tmp = pow(i, 4)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(2, 4):
        tmp = pow(i, 5)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(2, 4):
        tmp = pow(i, 6)
        if tmp <= X and tmp > buf:
            buf = tmp
    for i in range(7, 11):
        tmp = pow(2, i)
        if tmp <= X and tmp > buf:
            buf = tmp
    print(buf)

Solution (Python):
import math

X = int(input())
logX = int(math.log2(X))+10
value = 0
for i in range(2,logX):
    for j in range(1,X+1):
        value_temp = j ** i
        if value_temp <= X:
            value = max(value,value_temp)
print(value)

Solution (Python):
X = int(input())

for i in range(X, 0, -1):
    for j in range(31, 0, -1):
        for k in range(9, 1, -1):
            if pow(j, k) == i:
                print(i)
                exit()

Solution (Python):
x=int(input())
ans=1
for j in range(2,11):
    i=1
    while i**j<=x:
        ans=max(ans,i**j)
        i+=1

print(ans)

Solution (Python):

import math
x=int(input())
r=math.floor(math.sqrt(x))
i=2
j=2
ans=1
while(i<=r):
    while(i**j<=x):
        j+=1
    if(i**(j-1)>ans):
        ans=i**(j-1)
    j=2
    i+=1
print(ans)

Solution (Python):





if __name__ == '__main__':
    x = int(input())
    value = 0

    for i in range(100):
        for j in range(2, 10):
            tmp = pow(i, j)
            if tmp <= x and tmp > value:
                value = tmp

    print(value)

Solution (Python):
X = int(input())

if X==1:
    print(X)
    exit()

ans = 1
for b in range(2,33):
    for p in range(2,10):
        if b**p > ans and b**p <= X:
            ans = b**p

print(ans)

Solution (Python):

import math

X = int(input())

x_sqrt = math.ceil(math.sqrt(X))
ans = 1
calcEnd = False
for i in range(X, 0, -1):
    for j in range(x_sqrt, 1, -1):
        calc = j
        while calc <= i:
            calc *= j

            if calc == i:
                ans = i
                calcEnd = True
                break

        if calcEnd:
            break
    if calcEnd:
        break

print(ans)

Solution (Python):


X = int(input())

b=[1]
for i in range(1,X):
    for j in range(2,X):
        if i**j > X:
            break
        else:
            b.append(i**j)
print(max(b))

Solution (Python):
x = int(input())
ans = 1
for i in range(1,100):
    for j in range(2,15):
        if pow(i,j) <=x:
            ans = max(ans,pow(i,j))
print(ans)

Solution (Python):

import math

X = int(input())

bmax = round(math.sqrt(X))

bp = 1
for b in range(2, bmax + 1, 1):
    p = 2
    while(pow(b, p) <= X):
        p += 1
    p += -1
    if(bp < pow(b, p)):
        bp = pow(b, p)

print(bp)

Solution (Python):
if __name__ == '__main__':
    X = int(input())

    if X == 1:
        print("1")
        exit(0)
    if X == 1000:
        print("1000")
        exit(0)

    candidates = []
    for b in range(2, 31 + 1):
        p = 1
        while True:
            p += 1
            value = b ** p
            if value <= 1000:
                candidates.append(value)
            else:
                break

    candidates = sorted(set(candidates))
    for i in range(len(candidates) - 1):
        if candidates[i] <= X and X < candidates[i + 1]:
            print(candidates[i])
            exit(0)

Solution (Python):
X = int(input())
num = 1
max = 0
for i in range(1,X):
    for j in range(2,X):
        num = i ** j
        if num > X:
            break
        if max < num:
            max = num
if max != 0:
    print(max)
else:
    print(1)

Solution (Python):

import math

x = int(input())

maxcount = int(math.sqrt(x))

result = 0
for i in range(1,maxcount+ 1):
    j = 0
    while True:
        tmp = i ** (maxcount - j)
        j += 1
        if tmp > x:
            continue
        else:
            break
    if tmp > result and tmp <= x:
        result = tmp

print(result)

Solution (Python):


import math

N = int(input())

exp = [1]
for i in range(2,int(math.sqrt(N))+1):
	if pow(i,int(math.log(N,i))+1) <= N:
		exp.append(pow(i,int(math.log(N,i))+1))
	else:
		exp.append(pow(i,int(math.log(N,i))))
print(max(exp))

Solution (Python):
import math

X = int(input())
max_x = 0

for i in range(2, 1000):
    pow_x = i * i
    while pow_x <= X:
        max_x = max(max_x, pow_x)
        pow_x *= i

print(max(max_x, 1))

Solution (Python):
x = int(input())
if x == 1:
    print(1)
else:
    lst = []
    for i in range(2,6):
        for j in range(2,10):
            num = i**j
            if num <= x:
                lst.append(num)

    for i in range(6,33):
        for j in range(2,4):
            num = i**j
            if num <= x:
                lst.append(num)
    lst.sort()
    ans = lst[-1]
    print(ans)

Solution (Python):
from math import sqrt, floor

X = int(input())

if X in (1, 2, 3):
    print(1)
    exit(0)


max_beki = 1
base_list = [i for i in range(2, floor(sqrt(X)) + 1)]

for base in base_list:
    beki = base
    while beki <= X:
        beki *= base
        if beki > max_beki and beki <= X:
            max_beki = beki

print(max_beki)

Solution (Python):
X = int(input())

prime_num = range(2, 32)
num_list = [1]

for p in prime_num:
    i = 2
    while p ** i <= X:
        i += 1
    if i > 2:
        num_list += [p ** (i - 1)]

print(max(filter(lambda x: x <= X, num_list)))

Solution (Python):
num = int(input(''))

maxnum = 1
for i in range(2, int(num ** (1/2) + 1)):
    j = 2
    while True:
        if i ** j > num:
            break
        if i ** j > maxnum:
            maxnum = i ** j
            j += 1
        else:
            j += 1

print(maxnum)

Solution (Python):
x = int(input())

ret = [1]

for b in range(2, x):
    num = 0
    p = 2
    while(num < x):
        num = b**p
        p += 1
        if num <= x:
            ret.append(num)

print(max(ret))

Solution (Python):


x = int(input())

ans = 1
for b in range(1, 1001):
    for p in range(2, 11):
        result = pow(b, p)
        if result <= x:
            ans = max(ans, result)
        else:
            break
print(ans)

Solution (Python):
th=1000
v=[1]
for b in range(2,32):
  p=2
  while b**p <= th:
    v.append(b**p)
    p+=1

v=sorted(list(set(v)))
X=int(input())
m=0
for i in range(len(v)):
  if v[i] <= X and m < X:
    m = v[i]

print(m)

Solution (Python):
x=int(input())
ans=0
s=[]
s.append(1)
for i in range(2,32):
  num=i
  while num<=1000:
    num=num*i
    s.append(num)
s=sorted(s)
flag=False
for i in range(len(s)):
  if s[i]>x:
    ans=s[i-1]
    flag=True
    break
if flag:
  print(ans)
else:
  print(s[-1])

Solution (Python):
import math

X = int(input())

candidate = 1
for b in range(1, 101):
    for p in range(2, 10):
        temp = b ** p
        if temp > X:
            break
        candidate = max(temp, candidate)
print(candidate)

Solution (Python):
X=int(input())
max=1
for i in range (1,100):
    for j in range (2,100):
        if X>=i**j and i**j>max:
            max=i**j    
print (max)

Solution (Python):
X = int(input())
ans_list = [1] * 10
for i_beki in range(1, 10):
    for i in range(1, X):
        if i ** i_beki > X:
            ans_list.append((i - 1) ** i_beki)
            break

print(max(ans_list))

Solution (Python):
SET={1}
for i in range(2,10+1):
    x=2**i
    s=2
    while x<=1000:
        SET=SET|{x}
        s+=1
        x=s**i
LIST=list(SET)
X=int(input())

print(max([y for y in LIST if y<=X]))

Solution (Python):


import math
import sys
import itertools
import numpy as np

n = int(input())

a=[0]*1001  

for i in range(1,33):
    for j in range(2,10):
        k = i ** j
        if k > 1000:
            break
        else:
            a[k] = 1

for i in range(n,0,-1):
    if(a[i]==1):
        print(i)
        break

Solution (Python):
X = int(input())

ans = 1
for i in range(int(X**0.5)+5, 1, -1):
    p = 2
    while True:
        if i ** p <= X:
            ans = max(ans, i**p)
            p += 1
        else:
            break

print(ans)

Solution (Python):
x = int(input())

_max = 0
for i in range(1, x + 1):
	for j in range(2, 1000):
		num = i**j
		if num > x:
			break
		else:
			_max = num if num > _max else _max

print(_max)

Solution (Python):
n=int(input())
beki=[1,4,8,9,16,16,25,27,32,36,49,64,64,64,81,81,100,121,125,128,144,169,196,216,225,243,256,256,256,289,324,343,361,400,441,484,512,512,529,576,625,625,676,729,729,729,784,841,900,961,1000]
ans=0
for i in range(len(beki)):
   if beki[i]<=n:
       ans=max(ans, beki[i])

print(ans)

Solution (Python):


import math

x = int(input())

if x < 4:
    print(1)
else:
    p_max = int(math.sqrt(x))
    res = 0

    for n in range(2, p_max + 1, 1):
        tmp = n
        while tmp * n <= x:
            tmp = tmp * n
            if tmp > res:
                res = tmp

    print(res)

Solution (Python):
X=input()
a=set()
for b in range(1,100):
	for p in range(2,100):
		if b**p<=X:
			a.add(b**p)
		else:
			break

print max(a)

Solution (Python):
X = int(input())
for i in range(40):
  if i*i > X:
    a = i-1
    break
ans2 = a*a
for i in range(40):
  if i **3 > X:
    b = i-1
    break
ans3 = b**3
for i in range(40):
  if i **4 > X:
    b = i-1
    break
ans4 = b**4
for i in range(40):
  if i **5 > X:
    b = i-1
    break
ans5 = b**5
for i in range(40):
  if i **6 > X:
    b = i-1
    break
ans6 = b**6
for i in range(40):
  if i **7 > X:
    b = i-1
    break
ans7 = b**7
for i in range(40):
  if i **8 > X:
    b = i-1
    break
ans8 = b**8
for i in range(40):
  if i **9 > X:
    b = i-1
    break
ans9 = b**9
print(max(ans2,ans3,ans4,ans5,ans6,ans7,ans8,ans9))

Solution (Python):
X = int(input())
ans = 1
for b in range(2,X//2):
  tmp = b**2
  while tmp <= X:
    ans = max(ans,tmp)
    tmp *= b
print(ans)

Solution (Python):
from sys import stdin


def main():
    X = int(stdin.readline().rstrip())
    result = 1
    for b in range(1, X + 1):
        for p in range(2, X):
            if b ** p <= X:
                result = max(result, b ** p)
            else:
                break
        if b ** 2 > X:
            continue
    print(result)


if __name__ == '__main__':
    main()

Solution (Python):
import math
X = int(input())
x = int(math.sqrt(X))
maxVal = x
for i in range(2, x+1):
    val = i
    while val <= X:
        val *= i
    val = int(val/i)
    if val > maxVal:
        maxVal = val
print (maxVal)

Solution (Python):
s = [x**i for x in range(1,101) for i in range(2, 101)]
a = set(s)
x = int(input())
for u in range(x, 0, -1):
    if u in a:
        print(u)
        exit(0)

Solution (Python):
x = int(input())
table = [1]
for i in range(2,1000):
	b = 2
	while i**b <= 1000:
		table.append(i**b)
		b += 1
table.sort()
k = 0
while k <= len(table)-1 and table[k] <= x:
	k += 1
print(table[k-1])

Solution (Python):
import math
n = int(input())
a = int(n**0.5)+1
b = int(math.log2(n))+1
ans = 1

for i in range(2,a):
    for j in range(2,b):
        if n >= i**j:
            ans = max(ans,i**j)

print(ans)

Solution (Python):
if __name__ == '__main__':
	x = int(input())

	m = 0;
	for b in range(1, 1000):
		for p in range(2, 10):
			candi = b**p
			if candi > x:
				break
			if candi > m:
				m = candi

	print(m)

Solution (Python):
x = int(input())
ans = 1
for i in range(2,33):
    for j in range(2,11):
        if i ** j > x:
            break
        else:
            ans = max(ans, i**j)

print(ans)

Solution (Python):
X = int(input())
ans = 0
for i in range(1, 32):
    for j in range(2, 10):
        if i**j <= X and i**j >= ans:
            ans = i**j
print(ans)

Solution (Python):
X = int(input())
import bisect
exp_list = []
for i in range(1,32):
    for j in range(2,10):
        if pow(i,j) <= 1000:
            exp_list.append(pow(i,j))
        else:
            break
exp_list.sort()
i = bisect.bisect_right(exp_list,X)
print(exp_list[i-1])

Solution (Python):
def main():
    X = int(input())
    if X == 1000:
        return 1000

    beki = [1,]
    for i in range(2,35):
        for j in range(2,11):
            if i**j<= 1000:
                beki.append(i**j)
    beki.sort()
    for i in range(len(beki)):
        if beki[i]>X:
            return beki[i-1]

if __name__ == '__main__':
    print(main())

Solution (Python):
X = int(input())

m = 0
for b in range(1, 100):
    for p in range(2, 20):
        val = b ** p
        if val > 1000:
            continue
        if m < val <= X:
            m = val
        

print(m)

Solution (Python):
X = int(input())
powers = [1] + [2**i for i in range(2,10)] + [3**i for i in range(2,7)] + [5**i for i in range(2,5)] + [6**i for i in range(2,4)] + [7**i for i in range(2,4)] + [10**i for i in range(2,4)] + [a**2 for a in range(11,32)]
Y =filter(lambda n:n<=X, powers)
print(max(Y))

Solution (Python):
X = int(input())
ans = 1
for i in range(2,int(X/2 + 1)):
    for j in range(2,11):
        c = i ** j
        if c <= X and c > ans:
            ans = c

print(ans)

Solution (Python):

X = int(input())
primes = [2,3,5,7,11,13,17,19,23,29,31]
res = 0
for p in primes:
    for i in range(32):
        if i**p <= X:
            res = max(i**p, res)
        else:
            break
print(res)

Solution (Python):
X = int(input())

s = [1]
for i in range(X+1):
    for j in range(2,X+1):
        if i**j <= X and i**j not in s:
            s.append(i**j)
        if i**j > X:
            break
print(max(s))

Solution (Python):
x = int(input())

num = -1

for i in range(32):
    for j in range(10):
        if (i+1) ** (j+2) >= num and (i+1) ** (j+2) <= x:
            num = (i+1) ** (j+2)

print(num)

Solution (Python):
x = int(input())
l = []
for b in range(1,32):
    for j in range(2,10):
        if b**j <= x:
            l.append(b**j)
print(max(l))

Solution (Python):
X = int(input())
nmax = 0

for i in range(400):
    for j in range(2,30):
        a = i**j
        if a > X:
            continue
        elif nmax < a:
            nmax = a
            
print(nmax)

Solution (Python):
import math
x = int(input())
ans = 0
if x == 1:
    print(1)
    exit()
for i in range(2, math.floor(math.sqrt(x))+1):
    max = 0
    p = 1
    for j in range(10000):
        if i ** p <= x:
            max = i ** p
            p += 1
        else:
            break
    if max > ans:
        ans = max
print(ans)

Solution (Python):
x = int(input())
m = 1
for i in range(2, x):
    p = 2
    while pow(i, p) <= x:
        if m <= pow(i, p):
            m = pow(i, p)
        p += 1
    
        
print(m)

Solution (Python):
X = int(input())
beki = [1]
for i in range(2, X):
    c = 2
    while True:
        if i**c > X:
            break
        beki.append(i**c)
        c += 1
        
print(max(beki))

Solution (Python):
x = int(input())
out = 1
for i in range(2,33,1):
    for j in range(2,10,1):
        num = i**j
        if x >= num:
            out = max(out, num)
print(out)

Solution (Python):
import sys

n = int(input())

res = 0
if n == 1:
    print(1)
    sys.exit()
for i in reversed(range(2, n+1)):
    cnt = 2
    while True:
        if pow(i, cnt) > n:
            break
        else:
            if res < pow(i, cnt):
                res = pow(i, cnt)
        cnt += 1
print(res)

Solution (Python):
n = int(input())
ans = 1

for i in range(1, n):
  for j in range(2, n):
    if i ** j > n:
      break
    if i**j > ans:
      ans = i**j

print(ans)

Solution (Python):
x = int(input())
l = []

for i in range(1,32):
    for j in range(2,9):
        l.append(i ** j)
        
l = list(sorted(set(l)))
c = 1        
for i in range(len(l)):
    if l[i] <= x and x< l[i+1]:
        c = l[i]
        break
print(c)

Solution (Python):
x = int(input())
flag = False
while True:
    if flag:
        break
    for i in range(x):
        if flag:
            break
        for j in range(x):
            if i ** j == x:
                print(i ** j)
                flag = True
                break
            if i ** j > x:
                break
    x -= 1

Solution (Python):
import math

x = int(input())

max = 1
for i in range(2, int(math.sqrt(x)) + 1):
  for j in range(x):
    if i ** j > x:
      break
    else:
      if i ** j > max:
        max = i ** j

print(max)

Solution (Python):
def main():
    X = int(input())

    ans = 1
    m = int(X ** 0.5)
    for i in range(1, m+1):
        for j in range(2, m+1):
            if i ** j <= X:
                ans = max(ans, i ** j)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
X = int(input())

sq = [a ** 2 for a in range(32)[1:]]
sq += [a ** 3 for a in range(11)[1:]]
sq += [a ** 4 for a in range(6)[1:]]
sq += [a ** 5 for a in range(4)[1:]]
sq += [a ** 6 for a in range(4)[1:]]
sq += [a ** 7 for a in range(4)[1:]]
sq += [a ** 8 for a in range(4)[1:]]
sq += [a ** 9 for a in range(4)[1:]]
sq = [a for a in sq if a <= X]
print(max(sq))

Solution (Python):
x = int(input())
ans = 0
for i in range(int(x ** (1/2)) + 1):
  for j in range(10):
    if i ** j <= x and ans < i ** j:
      ans = i ** j
    else:
      continue
print(ans)

Solution (Python):
x = int(input())

up = int(x ** 0.5) + 1
max_n = 1
for i in range(1, up):
    for j in range(2, x):
        if i ** j > x:
            break
        if i ** j > max_n:
            max_n = i ** j

print(max_n)

Solution (Python):
x = int(input())

m = 1

for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > m:
            m = p

print(m)

Solution (Python):
x = int(input())
l =[1]

for i in range(2,200):
    if i*i > 1000:
        break
    for j in range(2,100):
        if i**j > 1000:
            break
        l.append(i**j)
l.append(1005)
l.sort()
for i in range(len(l)):
    if l[i]>x:
        print(l[i-1])
        exit(0)

Solution (Python):
x = int(raw_input())
ans = 1
for b in range(2,50):
  for p in range(2,15):
    n = b**p
    if n <= x:
      ans = max(ans, n)
print ans

Solution (Python):
x = int(input())
c = [1]
for i in range(2,32):
	num = 2
	while i**num<=x:
		c.append(i**num)
		num+=1
print(max(c))