Aditya Jain
Aditya Jain

Reputation: 59

pow function in python for very large numbers

I'm trying to calculate ordered pairs m,n in factors such that m*n | x-1. The thing is x is 1.1 * 10^6 digits long, and m and n are 5*10^5 digits long. I want to know whether the inbuilt pow will give me correct answers for this. I can't possibly check the value of 1000000 digit number, nor can I find any documentations on very large numbers in python. My code is below.

x=pow(2,3628800)
for n in factors:
    for m in factors:
        if x%(m*n)==1:
            ans+=1
        i+=1
        print(i)
print(ans)

Upvotes: 0

Views: 708

Answers (1)

Tushar Sadhwani
Tushar Sadhwani

Reputation: 565

Yes it will give you the correct output. In Python3 all integers are essentially limitless in terms of size.

Upvotes: 2

Related Questions