468,251 Members | 1,349 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,251 developers. It's quick & easy.

Is there any algorithm for comparing large numbers?

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
0 965

Post your reply

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

Similar topics

4 posts views Thread by koray | last post: by
3 posts views Thread by Alex Vinokur | last post: by
10 posts views Thread by Tuvas | last post: by
1 post views Thread by Jonathan | last post: by
3 posts views Thread by CFonville | last post: by
24 posts views Thread by Frank Swarbrick | last post: by
2 posts views Thread by Todd.Branchflower | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.