By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Is there any algorithm for comparing large numbers?

P: 3
input
4 # how many of those pieces at the bottom
4 2 2 2 2 2 # first number of numbers in this range -1
3 3 3 3 3
2 2 3 4
5 9 9 9 9 9 9

OUTPUT(index output in ascending order)
3 1 2 4

as here is raised to the power of 2 2 3 4

first 3 ^ 4 = 81 then 2 ^ 81 = 2417851639229258349412352

The question is how can you compare these numbers if you raise them to a power and then compare it is not possible? (or rather, but what resources are needed?)))


n = int(input())
h = {}
for i in range(n):
args = list(map(int, input().split()))
args.pop(0)
c = 1
for p in args[::-1]:
c = p ** c
h[i] = c
print(*[x[0] + 1 for x in sorted(h.items(), key=lambda x: x[1])])

https://math.stackexchange.com/questions/101138/complexity-class-of-comparison-of-power-towers
Jun 2 '18 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.