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



Sample input:
10


Sample output:
9

Submission status: Accepted

Solution code:
X = int(input())

if X == 1:
    ans = 1
else:
    b = 2
    p = 2
    ans = b ** p
    while b <= X:
        while True:
            tmp = b ** p
            if tmp <= X:
                ans = max(ans, tmp)
                p += 1
            else:
                break
        p = 2
        b += 1

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
res = 0
for i in range(1,int(x**.5)+1):
    for j in range(2,1000):
        if i ** j > x:
            break
        res = max(res, i ** j)
print(res)

Submission status: Accepted

Solution code:
X =int(input())
max = 1 #このように書かないとX = 1,2 のときに正しい値を返せない。listにappendだとlistが空になってエラーになる。
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            sub_max = k**(j-1)
            if sub_max >= max:
                max = sub_max
            break
            
print(max)

Submission status: Accepted

Solution code:
a = int(input())
m = 1
for i in range(a//2+1):
    for j in range(1,10):
        if a>=i**j and m <i**j:
            m = i**j
        if a < i**j:
            break
print(m)

Submission status: Accepted

Solution code:
from math import sqrt


def main():
    x = int(input())
    res = 1
    for i in range(2, int(sqrt(x)) + 1):
        b = i ** 2
        while b <= x:
            res = max(res, b)
            b *= i
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding; utd-8 -*-
X = int(input())
import math
a = [math.pow(i,j) for j in range(2,11) for i in range(1,32) if math.pow(i,j)<=X]
print(int(max(a)))

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a==1: print("Yes")
    else :print("No")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

x = ip()                              #入力整数1つ
#x,y = (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#a,b,c,k = (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
num = 1
max = 1
for i in range(1,x+1):
    for j in range(2,x+1):
        l = pow(i,j)
        if l>x: break
        elif l > max: max = l
print(max)

Submission status: Accepted

Solution code:
n=int(input())

a=[1]
for i in range(2,33):
	for j in range(2,11):
		x=i**j
		if x<=1000:
			a.append(x)

a=list(set(a))
a.sort()
	
def binarySearch(value, xList):
    low=0
    high=len(xList)
    while low!=high:
        mid=(low+high)//2
        if xList[mid]<=value:
            low=mid+1
        else:
            high=mid
    return xList[low-1]
		
print(binarySearch(n,a))

Submission status: Accepted

Solution code:
import math

X = int(input())
max_exp = 0

for b in range(1,50) :
    for p in range(2,10) :
        exp = int(math.pow(b,p))
        if (exp > X) :
            continue
        if (max_exp < exp)  :
            max_exp = exp

print(max_exp)

Submission status: Accepted

Solution code:
x=int(input())
#print(x)

list1=[1]
for i in range(2,32):
  n=2
  while i**n <= 1000:
    list1.append(i**n)
    n+=1

list1.sort()
#print(list1)

list1=[i for i in list1 if i <= x]

print(max(list1))

Submission status: Accepted

Solution code:
x = int(input())
y = [1]
for i in range(2, x+ 1):
    j = 2
    while i**j <= x:
        y.append(i ** j)
        j +=1
print(max(y))

Submission status: Accepted

Solution code:
a = int(input())
ar = []
if a == 1:
    print(1)
else:
    for i in range(1,a+1):
        for j in range(2,a+1):
            if i ** j <= a:
                ar.append(i ** j)
            else:
                break
    print(max(ar))

Submission status: Accepted

Solution code:
X = int(input())
expoList = []

def addList(i):
    for p in range(2,10):
        if i**p <= X:
            expoList.append(i**p)
        else:
            break

for q in range(1,32):
    addList(q)

expoList.sort()
print(expoList[-1])

Submission status: Accepted

Solution code:
x = int(input())
a = []
for b in range(1, 100):
    for p in range(2, 100):
        exp = b ** p
        if b == 1:
            a.append(1)
            break
        else:
            if b ** p <= x:
                a.append(b ** p)
            else:
                break
a = sorted(a)
print(a[-1])

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
list_a = []
for i in range(2, n+1):
    for b in range(1, 100):
        for p in range(2, 10):
            if i == b**p and i<=n:
                ans = i
                list_a.append([i, b, p])
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
m = 0
for b in range(1, 32):
  p = 2
  while b**p <= x:
    if m < b**p:
      m = b**p
    p += 1
    if b == 1:
      break
print(m)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for i in range(1,1001):
    for j in range(2,10):
        a = i**j
        if a <= x:
            ans = max(ans, a)
print(ans)

Submission status: Accepted

Solution code:
X=int(input())
s=[]
for i in range(1,100,+1):
    for j in range(2,100,+1):
     if i**j<=X:
        s.append(i**j)
print(max(s))

Submission status: Accepted

Solution code:
x = int(input())
maxn = 0
for i in range(1,1000):
    for j in range(2,11):
        d = i**j
        if d <= x:
            maxn = max(i**j,maxn)
print(maxn)

Submission status: Accepted

Solution code:
a=int(input())

b=[]

for k in range(2,10):
	for i in range(1,32):
		if i**k<=1000:
			b.append(i**k)
#print(b)
c=[]
for i in b:
	if a>=i:
		c.append(i)
print(max(c))

Submission status: Accepted

Solution code:
import math
tmp=0
x=int(input())

upper_b=int(math.sqrt(x))

for i in range(1,upper_b+1):
  for j in range(2,11):
    if i**j <=x:
      tmp=max(tmp,i**j)
print(tmp)

Submission status: Accepted

Solution code:
list = [1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,243,256,289,324,343,361,400,441,484,512,529,576,625,676,729,784,841,900,961,1000]
x = int(input())

for i in sorted(list,reverse = True):
  if x >= i:
    print(i)
    break

Submission status: Accepted

Solution code:
x = int(input())
a =[1]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c**n)
        n += 1
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))]+x)

Submission status: Accepted

Solution code:
import math
x=int(input())
if x==1 or x==2 or x==3:
  print(1)
  exit()
a=int(math.sqrt(x))
m=0
b=0
for i in range(2,a+1):
  b=1
  while True:
    b*=i
    if b>x:
      break
    if b>m:
      m=b
print(m)

Submission status: Accepted

Solution code:
a = int(input())

i = 2
max_num = 1
while i <= a:
    j = 2
    temp = 0
    while i**j <= a:
        temp = i**j
        j+=1

    if temp > max_num and temp <= a:
        max_num = temp
    i+=1
print(max_num)

Submission status: Accepted

Solution code:
n=int(input())
max=0
if(n==1):
  print(1)
else:
  for i in range(n):
    for j in range(2,10):
      if(max<=i**j and i**j<=n):
        max=i**j
  print(max)

Submission status: Accepted

Solution code:
z=int(input())
x=[]
for i in range(31):
  for j in range(10):
    if (i+1)**(j+2)<=z:
      x.append((i+1)**(j+2))
print(max(x))

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    if x == 1:
        print(1)
        return

    m = 1
    for b in range(2, x):
        p = 2
        while True:
            e = b ** p
            if e > x:
                break
            if e > m:
                m = e
            p += 1

    print(m)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())
b = 2
ans = 1
while b ** 2 <= x:
    p = 2
    while b ** p <= x:
        p += 1
    if b ** (p - 1) > ans:
        ans = b ** (p - 1)
    b += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
mx=0
for i in range(1,32):
    for j in range(2,10):
        x=i**j
        if x<=n:
            mx=max(mx,x)
print(mx)

Submission status: Accepted

Solution code:
import math

x = int(input())

pow_list = [1, 1000]
i = 2
while i**2 < 1000:
    j = 2
    while i**j < 1000:
        pow_list.append(i**j)
        j += 1
    i += 1

pow_list = set(pow_list)

for i in range(x, 0, -1):
    if i in pow_list:
        res = i
        break

print(res)

Submission status: Accepted

Solution code:
n=int(input())
 
mx=1
for i in range(2,11):
    mx=max(mx,int(n**(1/i)+0.0000000000001)**i)
 
print( mx)

Submission status: Accepted

Solution code:
import itertools
X = int(input())
table = [0] * 1001
for b, p in itertools.product(range(1, 32), range(2, 10)):
    if b ** p < 1001:
        table[b ** p] = 1
print(X - table[X::-1].index(1))

Submission status: Accepted

Solution code:
X = int(input())
for i in range(X,0,-1):
    for j in [2,3,5,7,11]:
        if round(pow(i,1/j),10).is_integer():
                print(i)
                exit()

Submission status: Accepted

Solution code:
X = int(input())

result = 1

for i in range(2, 33):
    for j in range(2, 11):
        r = i**j
        if r <= X:
            result = max(result, r)

print(result)

Submission status: Accepted

Solution code:
x = int(input())
c = 1
for i in range(2,32):
  for j in range(2,10):
    b = i ** j
    if b > x: 
      break
    elif b > c:
      c = b
print(c)

Submission status: Accepted

Solution code:
X = int(input())
max_e = 0

for b in range(1, 33):
    for p in range(2, 10):
        exp = pow(b, p)
        if exp > X:
            break
        else:
            max_e = max(exp, max_e)

print(max_e)

Submission status: Accepted

Solution code:
X = int(input())
if X == 1:
    print(1)
else:
    ans = 1
    for i in range(2, X+1):
        for k in range(2, 10):
            now = i ** k
            if now <= X:
                ans = max(ans, now)
    print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for i in range(1, x+1):
    for j in range(2, 9):
        s = i**j
        if s <= x and ans < s:
            ans = s
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
l = [1, 4, 8, 16, 32, 64, 128, 256, 512, 9, 27, 81, 243, 729, 25, 125, 625, 36, 216, 49, 343, 100, 1000, 121, 144, 169, 196, 225, 289, 324, 361, 400, 441, 484, 529, 576, 26**2, 28**2, 29**2, 900, 31**2]
l = list(set(l))
l.sort()
for i in range(len(l)):
  if x < l[i]:
    print(l[i-1])
    break
  elif x == 1:
    print('1')
    break
  elif x == 1000:
    print('1000')
    break

Submission status: Accepted

Solution code:
import math

x = int(input())

rx = math.sqrt(x)
ceil = int(math.ceil(rx))
ans = 1
for i in range(2, ceil):
    num = 1
    while num <= x:
        num *= i

    if ans < (num / i):
        ans = int((num / i))
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
for b in range(1001):
    for p in range(2, 10):
        if b ** p <= x and b ** p > ans:
            ans = b ** p

print(ans)

Submission status: Accepted

Solution code:
L = []
for b in range(1001) :
    for p in range(2,12) :
        l = b**p
        if l <= 2000 :
            L.append(l)
L = sorted(list(set(L)))
X = int(input())
for i in range(len(L)+1) :
    if L[i] <= X < L[i+1] :
        print(L[i])
        break

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

x = ni()

if x == 1:
    print(1)
    
else:
    ans = 0
    for b in range(2,40):
        for p in range(2,11):
            if ans < b**p <= x:
                ans = b**p
                
            if b**p > x:
                break
            
    print(ans)

Submission status: Accepted

Solution code:
X = int(input())

ans = 1
for n in range(2,32):
    tmp = n*n
    while tmp <= X:
        ans = max(ans,tmp)
        tmp *= n
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
i=2
ans=[1]
while(i**2 <= n ):
  j=2
  while( i**(j+1) <=n ):
    j+=1
  ans.append( i**j)
  i+=1

print( max(ans) )

Submission status: Accepted

Solution code:
s=input()
X=int(s)

if(X==1):
    print(1)
else:
    data=[]
    for b in range(1,35):
        for p in range(2,10):
            xt=b**p
            if(xt>1000):
                break
            data.append(xt)

    dist=abs(data[0]-X)
    ans=data[0]
    for i in range(1,len(data)):
        if(data[i]<=X and abs(data[i]-X)<=dist):
            dist=abs(data[i]-X)
            ans=data[i]

    print(ans)

Submission status: Accepted

Solution code:
X = int(input())
 
ans = 1
for b in range(2, 1000):
  c = b
  for p in range(2, 1000):
    c *= b
    if c > X:
      break
    ans = max(ans, c)
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

ans = 1
for b in range(2, 1000):
  c = b
  for p in range(2, 1000):
    c *= b
    if c > X:
      break
    ans = max(ans, c)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())

flag = False
if N<4:
  print(1)
else:
  for i in range(N):
    for j in range(2, round(math.sqrt(N-i))+1):
        a = math.log(N-i, j)
        b = math.modf(a)
        if b[0] == 0.0 or b[0] > 0.99999:
          flag = True
          print(round(j**a))
          break
    if flag:
      break

Submission status: Accepted

Solution code:
X = input()
res = 0
for p in range(2, 10):
	for b in range(1, int(1000 ** 0.5) + 1):
		cand = b ** p
		if cand > X:
			break
		res = max(res, cand)
print res

Submission status: Accepted

Solution code:
x = int(input())

ar = []

for i in range(2, 11):
  for j in range(1, 40):
    if j ** i <= x:
      ar.append(j ** i)
print(max(ar))

Submission status: Accepted

Solution code:
def factorize(m):
  facs=[]
  i=2
  if m==1:
    return [0]
  while m>1:
    j=0
    if m%i!=0:
      i+=1
    while m%i==0:
      j+=1
      m/=i
      if m%i!=0:
        facs.append(j)
        i+=1
        break
  return facs

def GCM(m,n):
  if m>n:
    m,n=n,m
  gcm=m
  while gcm>1:
    if n%gcm==0 and m%gcm==0:
      return gcm
    else:
      gcm-=1
  return 1

def GCM_many(s):
  gcm=s[0]
  for i in range(1,len(s)):
    gcm=GCM(gcm,s[i])
  return gcm

n=int(input())
if n==1:
  print(1)
  exit()
for i in range(1, n+1)[::-1]:
  facs=factorize(i)
  if GCM_many(facs)>1:
    print(i)
    exit()
print(1)

Submission status: Accepted

Solution code:
x = int(input())

sqrt = int(x**(1/2))
ans = 1
for b in range(2, sqrt+1):
    p = 2
    while b**p <= x:
        ans = max(ans, b**p)
        p += 1
print(ans)

Submission status: Accepted

Solution code:
import math
X = int(input())
Xr = int(math.sqrt(X))
ans = 1
for i in range(2, Xr + 1):
    t = i ** int(round(math.log(X, i), 10))
    if t > ans:
        ans = t
print(ans)

Submission status: Accepted

Solution code:
import sys
x=int(input())
ok=[]
for i in range(x+1):
  ok.append(False)
ok[1]=True
for b in range(2, x+1):
  y=b*b
  while y<=x:
    ok[y]=True
    y*=b
for i in range(x):
  if ok[x-i]:
    print(x-i)
    sys.exit()

Submission status: Accepted

Solution code:
# Exponential
x = int(input())
ans = 0
for i in range(1, 34):
    for j in range(2, 11):
        if ans < i ** j <= x:
            ans = i ** j
print(ans)

Submission status: Accepted

Solution code:
import math


def run(X):
    ret = 1
    for i in range(2, X):
        for j in range(2, int(math.log2(X))):
            tmp = i**j
            if tmp > X:
                break
            ret = max(ret, tmp)
    return ret


def main():
    X = int(input())
    print(run(X))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
ans=0
if x==1:
    print(1)
else:
    for i in range(2,32):
        p=2
        while i**p<=x:
            if i**(p+1)>x:
                a=i**p
                break
            else:
                p +=1
        ans=max(ans,a)
    print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
x = int(input())

res=1

for b in range(1,32):
  for p in range(2,9):
    n=b**p
    if n > x:
      break
    res=max(res,n)

print(res)

Submission status: Accepted

Solution code:
X = int(input())
L = [1]
for i in range(2, 32):
	j = 2
	while True:
		if i ** j > 1000:
			break
		else:
			if L.count(i ** j) == 0:
				L.append(i ** j)
			j += 1
L = sorted(L)

ans = 1
for i in L:
	if X >= i:
		ans = i
	else:
		break

print(ans)

Submission status: Accepted

Solution code:
X = int(input())
r =1

for b in range(2,X+1):
  p = 2
  while b**p <=X:
    if r < b**p:
       r = b**p
    p = p+1

print(r)

Submission status: Accepted

Solution code:
x = int(input())
a = []
for i in range(1,32):
  for j in range(2,9):
    if i ** j <= x:
      a.append(i**j)
print(max(a))

Submission status: Accepted

Solution code:
x = int(input())
ans = 1
if x != 1:
    for i in range(x):
        for f in range(2,x):
            z = i**f
            if z > x:
                break
            elif z > ans:
                ans = z
    print(ans)
else:
    print(ans)

Submission status: Accepted

Solution code:
X = int(input())
ans = []
for b in range(1, 100):
    for p in range(2, 100):
        if b**p <= X:
            ans .append(b**p)
        else:
            break

print(max(ans))

Submission status: Accepted

Solution code:
X = int(input())

l = [1]

for i in range(2,33):
    b=2
    while i**b<=1000:
        l.append(i**b)
        b+=1

l2 = [n for n in l if n<=X]

print(max(l2))

Submission status: Accepted

Solution code:
x=int(input())
ans=chk=1
for i in range(x):
    for j in range(2,11):
        chk=i**j
        if chk<=x: ans=max(ans,chk)
    
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
a = 1

for b in range(2,X+1):
  p = 2
  while(True):
    if pow(b, p) > X:
      if ans < a:
        ans = a
      break
    else:
      a = pow(b, p)
      p += 1

    
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

maxnum = 0
for j in range(2, 11):
    for i in range(1, x+1):
        if i**j <= x:
            maxnum = i**j if i**j >= maxnum else maxnum
 
print(maxnum)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x=int(input())
a=[]
j=1
for i in range(2,x+1):
    j=i
    while(j*i<=x):
        j=j*i
        a.append(j)
a.append(1)
print(max(a))

Submission status: Accepted

Solution code:
x = int(input())
m = 1
b = 2
while b*b <= x:
  p = 2
  while b**p <= x:
    m = max(m, b**p)
    p += 1
  b += 1
print(m)

Submission status: Accepted

Solution code:
#encoding utf-8
x = int(input())

exp_list = [1]
for i in range(2,33):
    j = 2
    while(i**j <= 1000):
        exp_list.append(i**j)
        j += 1

exp_list.sort()
in_list = [i for i in exp_list if i <= x]
print(in_list[-1])

Submission status: Accepted

Solution code:
import math
x = int(input())
ans = 1
for a in range(int(math.sqrt(x))+2):
    for b in range(2, x):
        if a ** b <= x:
            ans = max(ans, a ** b)
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
p = 2
list_prob = []
ind = 0
i = 1
while p < 11:
    ind = i ** p
    while ind < 1001:
        list_prob.append(int(i ** p))
        i += 1
        ind = i ** p
    i = 1
    p += 1
list_prob.append(1001)
list_prob.sort()
while i < len(list_prob):
    if list_prob[i] <= x and list_prob[i+1] > x:
        print(list_prob[i])
        break
    i += 1

Submission status: Accepted

Solution code:
a = int(input())
x = 1
ans = 1
for x in range(2,a):
    y = 2
    while x**y <= a:
        ans = max(ans, x**y)
        y += 1
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
exp = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000]

if x in exp:
    print(x)
else:
    exp.append(x)
    exp.sort()
    print(exp[exp.index(x)-1])

Submission status: Accepted

Solution code:
x = int(input())

ans = 1
for b in range(2, x):
    p = 2
    while b ** p <= x:
        ans = max(ans, b ** p)
        p += 1

print(ans)

Submission status: Accepted

Solution code:
import math
x = int(input())
if x < 4:
    print(1)
    exit()
else:
    m = int(math.sqrt(x))
    p = int(math.log2(x))
    ans = 0
    for i in range(2, m+1):
        for j in range(2, p+1):
            if i**j <= x:
                ans = max(ans, i**j)
    print(ans)

Submission status: Accepted

Solution code:
arr = [0 for _ in range(1001)]
arr[1] = 1
for i in range(2,32):
    if arr[i]==1:
        continue
    tmp=i*i
    while tmp <=1000:
        arr[tmp]=1
        tmp*=i

for x in range(int(input()),0,-1):
    if arr[x]==1:
        print(x)
        break

Submission status: Accepted

Solution code:
import math
x=int(input())
max=0

if x==1000:
  max=1000
for i in range(2,10):
  y=int(math.pow(x,1.0/float(i)))
  if max<y**i:
    max=y**i
print(max)

Submission status: Accepted

Solution code:
x = int(input())

max_exp = 1
for b in range(2, x + 1):
    
    p = 2
    while True:
        ans = b ** p
        #print(ans)
        if ans <= x:
            max_exp = max(max_exp, ans)
            p += 1
        else:
            break

print(max_exp)

Submission status: Accepted

Solution code:
x = int(input())

temp = [0 for _ in range(1001)]
for i in range(1, 32):
    for j in range(2,10):
        hoge = i ** j
        if hoge > 1000:
            break
        else:
            temp[hoge] = 1

for i in range(x, -1, - 1):
    if temp[i] == 1:
        print(i)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

max_result = 0
# Sarch base between 32 ** 2(lowest p) = 1024 
for b in range(1, 33):
    # Search power between 2~10 because 2(lowest b)^10 = 1024
    for p in range(2, 11):
        canditate = b**p
        if canditate <= x and canditate > max_result:
            max_result = canditate

print(max_result)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
x = int(input())
while True:
    for b in range(1, x + 1):
        for p in range(2, 20):
            if x == b ** p:
                print(x)
                sys.exit()
    x -= 1

Submission status: Accepted

Solution code:
X = int(input())

def is_exponential(n,j):
    tmp = 1

    while (tmp < j):
        tmp *= n
        if tmp == j:
            return 1
        elif tmp > j:
            return 0

j = X
while (j > 0):
    res = []
    for i in range(2, j):
        res.append(is_exponential(i,j))
    if sum(res) > 0:
        print(j)
        break
    j -= 1
    if j == 0:
        print(X)

Submission status: Accepted

Solution code:
X = int(input())
a = 1
for i in range(1,X+1):
  for j in range(2,X+1):
    if (i**j > X):
      break
    if (a <= i**j <= X):
      a = i**j
print(a)

Submission status: Accepted

Solution code:
# coding:utf-8

import math

N = int(input())

b = 2
p = 2
ans = 1
while b <= math.sqrt(N):
  tmp = b ** p
  while tmp <= N:
    tmp *= b
    
  ans = max(ans, tmp // b)
  b += 1

print(ans)

Submission status: Accepted

Solution code:
X = int(input())
ans = 1

for i in range(2, X + 1):
    j = 2
    while i ** j <= X:
        ans = max(ans, i ** j)
        j += 1

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
max=round(x**0.5)+1

index=1
maxA=0
while index<max:
    index2=2
    while True:
        if index**index2<=x:
            if index**index2>maxA:
                maxA=index**index2
            index2+=1
            if index==1:
                break
        else:
            break
    index+=1
print(maxA)

Submission status: Accepted

Solution code:
def is_exp(num):
	for b in range(2, 33):
		num_copy = num
		counter = 0
		while not num_copy % b:
			num_copy /= b
			counter += 1
		if num_copy == 1:
			if counter == 1:
				return False
			else:
				return True
	else:
		return False

N = int(input())
if N <= 3:
	print(1)
else:
	for num in range(N,0,-1):
		if is_exp(num):
			print(num)
			break

Submission status: Accepted

Solution code:
N = int(input())
m = 0

for b in range(N):
    if N < b**2:
        break
    for p in range(N):
        if m < b**p:
            if N >= b**p:
                m = b**p
            else:
                break

print(m)

Submission status: Accepted

Solution code:
import math

x=int(input())
ma=1

for i in range(2,int(x**0.5)+1):
    lo=int(math.log(x,i))
    a=i**lo
    b=i**(lo+1)
    if a<=x :
        ma=max(ma,a)
    if b<=x :
        ma=max(ma,b)

print(ma)

Submission status: Accepted

Solution code:
x,ans = int(input()),[]
for i in range(x):
    for l in range(x-2):
        if (i+1)**(l+2) <= x: ans.append((i+1)**(l+2)) 
        else:break
print("1" if ans == [] else max(ans))

Submission status: Accepted

Solution code:
n=int(input())
result=1
for i in range(1,n+1):
    for j in range(2,n+1):
        if i**j>n:
            break
        if i**j > result:
            result = i**j
print(result)

Submission status: Accepted

Solution code:
X = int(input())
ans = 0
for b in range(1,X+1):
    for p in range(2,X+1):
        if b ** p > X:
            break
        if b ** p > ans:
            ans = b ** p
print(max(1,ans))

Submission status: Accepted

Solution code:
lst = [1]
X = int(raw_input())

cnt = 2
now = 4
while cnt <= X:
	if now <= X and now not in lst:
		lst.append(now)
		now = now * cnt
	else:
		cnt = cnt + 1
		now = cnt * cnt
lst.sort()
print lst[-1]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

beki = [1]
for b in range(2,32):
    for p in range(2,1000):
        if b**p <= 1000:
            beki.append(b**p)
        else:
            break

beki.sort()
beki = beki[::-1]

for a in beki:
    if a <= X:
        print(a)
        break

Submission status: Accepted

Solution code:
x = int(input())
cardinal = 2
exponential = 2
pows = set([1])
def makePows(cardinal, exponential, maxNum):
    resultPow = pow(cardinal, exponential)
    if resultPow > maxNum:
        return

    makePows(cardinal+1, exponential, maxNum)
    makePows(cardinal, exponential+1, maxNum)

    pows.add(resultPow)

makePows(cardinal, exponential, 1000)

for i in sorted(pows):
    if x < i:
        break
    maxPow = i

print(maxPow)

Submission status: Accepted

Solution code:
import math

X = int(input())

def main():
    hit_nums = set([1])
    
    limit = math.floor(math.sqrt(X))
    base = 2
    while base <= limit:
        curr = base
        while curr <= X:
            hit_nums.add(curr)
            curr *= base
        base += 1

    print(max(hit_nums))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math


X = int(input())

r = 0

if X == 1:
    r = 1
else:
    for b in range(2, math.ceil(X ** 0.5)):
        for p in range(2, math.ceil(X ** 0.5)):
            if b ** p > X:
                break
            else:
                r = max(r, b ** p)

print(r)

Submission status: Accepted

Solution code:
#97b
x = int(input())
array = []
for i in range(1,33):
    for j in range(2,10):
        a = i**j
        if a <= x:
            array.append(a)
array.sort(reverse=True)
print(array[0])

Submission status: Accepted

Solution code:
n = int(input())
array = []
for i in range(1,33):
  for j in range(2,10):
    a = i**j
    if a <= n:
      array.append(a)
array.sort(reverse=True)
print(array[0])

Submission status: Accepted

Solution code:
# -*- encoding: utf-8 -*-

x = int(input())

l = [False] * (x + 1)

l[1] = True
for i in range(2, x + 1):
    v = i * i
    while (v <= x):
        l[v] = True
        v *= i

res = x
for i in l[::-1]:
    if i is True:
        print(res)
        break
    res -= 1

Submission status: Accepted

Solution code:
import math
#X = int(input())
b = [0 for i in range(1001)]
for i in range(2, 1001):
    j = i * i
    while j < 1001:
        if b[j] == 1:
            break
        b[j] = 1
        j *= i
b[1] = 1
X = int(input())
for i in range(X, 0, -1):
    if b[i] == 1:
        print(i)
        break

Submission status: Accepted

Solution code:
X = int(input())
L = []
ANS = []
for i in range(1,33) :
    for j in range(2,11) :
        if i**j <= 1192 :
            l = i**j
            L.append(l)
L = list(set(L))
L = sorted(L)
for j in range(len(L)) :
    if L[j] <= X < L[j+1] :
        ans = L[j]
        ANS.append(ans)
print(max(ANS))

Submission status: Accepted

Solution code:
N = int(input())

ans = 1

for b in range(2,32):
  for p in range(2,11):
    if b ** p <= N:
      ans = max(ans, b**p)

print(ans)

Submission status: Accepted

Solution code:
X = int(input())
a = []
for i in range(1, X + 1):
    for j in range(2, 11):
        b = i ** j
        if b <= X:
            a.append(b)
print(max(a))

Submission status: Accepted

Solution code:
X = int(input())
max = 1

for i in range(1, X):
    for j in range(2, X):
        if X < i**j:
            break
        if max < i**j:
            max = i**j
print(max)

Submission status: Accepted

Solution code:
x = int(input())
ans = [1]
for i in range(2, x + 1):
  for j in range(2, x + 1):
    exp = i ** j
    if exp <= x:
      ans.append(exp)
    else:
       break
print(max(ans))

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
for i in range(2, 40):
    p = 2
    while(i ** p <= X):
        ans = max(ans, i ** p)
        p += 1
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
for i in range(X+1):
    for j in range(2, 100):
        if i**j <= X:
            ans = max(ans, i**j)
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

maxInt = 1

i = 2
while i * i <= x:
	exp = i * i
	while exp <= x:
		exp *= i
	else:
		maxInt = max(maxInt, exp // i)
		i += 1
print(maxInt)