Project Euler Problem 97 Solution

Project Euler Problem 97 Solution

Large Non-Mersenne prime

by {BetaProjects} | Project Euler & HackerRank

Project Euler Problem 97 Statement

Solution

Python Source Code

s = 0
m = 10**12
for _ in range(int(input())):
    a, b, c, d = map(int, input().split())
    s += (a * pow(b, c, m) + d) % m
print("%012d" % (s % m))	

Last Word