I am trying to print a very large number by calculating very large powers of an integer. Although my code is correct, i am not observing the desired output.
Generally, python interpreter can print very large integer as much as the system memory supports. With that assumption in mind below is the code i am running.
a = int(input())
b = int(input())
c = int(input())
d = int(input())
import math
if a in range(1,1001):
if b in range(1,1001):
if c in range(1,1001):
if d in range(1,1001):
print((math.pow(a,b)+math.pow(c,d)))
The output which i am observing is
4710194409608608302099333120
The output which is expected is
4710194409608608369201743232
Can you please provide me pointers to how this can be solved? Input Values are:
a = 9
b = 29
c = 7
d = 27