Your code only finds candidates, but does not check if they really match. A floating point inaccuracy makes it impossible to make the difference between a very large value like this and the same value minus one.
But since python has a built-in unlimited range of integer artifacts, you can check that what you find is really consistent.
: , ( ), integer .
from math import log,sqrt,floor
import sys
n = 76 ** 89
t=floor(sqrt(n))+1
flag=False
for i in range(2,t):
x=log(n,i) # faster than x=log(n,2)/log(i,2)
if x-int(x)<sys.float_info.epsilon:
x = int(round(x))
r = int(round(n**(1/x)))
print("found candidate: ",x,r)
if n == r**x: # exact integer comparison with initial value & found values
print("YESSSSSSSSSSSSS!")
flag=True
break
else:
print("but not exact")
if not flag:
print("Nooooooooooooooooooo!")
76 ** 89 - 1
, " ", n
.
, x=log(n,2)/log(i,2)
x=log(n,2)/log(i,2)
x=log(n,i)
, , , .