Largest Exponential¶

Instead of trying to compare the powers $x^y$ directly, compare their logarithms $y\log{x}$.

In [1]:
with open("txt/0099_base_exp.txt") as f:
    pairs = tuple(tuple(int(x) for x in line.split(",")) for line in f)
In [2]:
logpows = {(x, y): y * log(x) for (x, y) in pairs}
max(enumerate(logpows, start=1), key=lambda x: logpows[x[1]])
Out[2]:
(709, (895447, 504922))

Copyright (C) 2025 filifa¶

This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license and the BSD Zero Clause license.